39 lines
720 B
C#
39 lines
720 B
C#
using UnityEngine;
|
|
|
|
public class Ability : MonoBehaviour
|
|
{
|
|
[Header("Identification")]
|
|
public string abilityName;
|
|
public EntityStats thisEntity;
|
|
[Header("Cooldown")]
|
|
public float currentCooldown;
|
|
public float cooldown;
|
|
[Header("Stats")]
|
|
public float power;
|
|
public Vector3 targetLocation;
|
|
|
|
protected virtual void Update()
|
|
{
|
|
if (currentCooldown > 0f)
|
|
{
|
|
currentCooldown -= Time.deltaTime;
|
|
}
|
|
}
|
|
|
|
public bool TryAbility()
|
|
{
|
|
if (currentCooldown <= 0f)
|
|
{
|
|
AbilityEffects();
|
|
currentCooldown = cooldown;
|
|
//Debug.Log($"Ability {abilityName} SUCCESS");
|
|
return true;
|
|
}
|
|
//Debug.Log($"Ability {abilityName} ON COOLDOWN");
|
|
return false;
|
|
}
|
|
protected virtual void AbilityEffects()
|
|
{
|
|
|
|
}
|
|
}
|