CooldownData.cs (977B)
1 namespace Slimecing.Abilities 2 { 3 [System.Serializable] 4 public class CooldownData 5 { 6 private Ability ability; 7 private float cooldown; 8 private int useAmount = 0; 9 public Ability GetAbility => ability; 10 public int UseAmount => useAmount; 11 public bool IsCoolin => cooldown > 0 || useAmount > 0; //? true : false; 12 13 public CooldownData(Ability ability, float cooldown) 14 { 15 this.ability = ability; 16 this.cooldown = cooldown; 17 } 18 19 public CooldownData (Ability ability, float cooldown, int useAmount) 20 { 21 this.ability = ability; 22 this.cooldown = cooldown; 23 this.useAmount = useAmount - 1; 24 } 25 26 public void TickCooldown(float delta) 27 { 28 if (useAmount > 0) return; 29 cooldown -= delta; 30 31 } 32 public void SubUseAmount() 33 { 34 useAmount -= 1; 35 } 36 } 37 }