RiftMayhem/Assets/Scripts/AbilitySystem/SimpleMeleeSlashAbility.cs
Pedro Gomes a966809f20 Update with class & attack
- melee attack first iteration (WIP)
- priest playable class
- priest "holy ball" ability
2024-05-21 20:37:07 +01:00

45 lines
1.5 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "SlashAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Simple Slash Ability", order = 0)]
public class SimpleMeleeSlashAbility : BaseAbility
{
public GameObject slashPrefab;
public bool regenHealthOnHit;
public bool regenManaOnHit;
public float healthOnHit;
public float manaOnHit;
public float lifeSpan;
public float range;
private GameObject instantiatedSlash;
private NetworkedSlash networkedSlash;
public override void Execute(PhotonView user, Taggable userTag)
{
base.Execute(user, userTag);
Debug.Log($"Player {user.name} used {this.name} and spent {manaCost} mana.");
instantiatedSlash = PhotonNetwork.Instantiate("Abilities/" + slashPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
networkedSlash = instantiatedSlash.GetComponent<NetworkedSlash>();
networkedSlash.owner = user;
networkedSlash.ownerTag = userTag;
networkedSlash.ability = this;
networkedSlash.lifeSpan = lifeSpan;
networkedSlash.range = range;
networkedSlash.regenHealthOnHit = regenHealthOnHit;
networkedSlash.regenManaOnHit = regenManaOnHit;
networkedSlash.healthOnHit = healthOnHit;
networkedSlash.manaOnHit = manaOnHit;
networkedSlash.Init();
}
}