using System; using UnityEngine; public class OfficerAbilities : ClassAbility { [Header("Kills")] [SerializeField] private int killQuota; private int currentKills; [Header("Length")] [SerializeField] private int abilityLength; [SerializeField] private int roundsRemaining; private void Start() { Enemy.OnKill += UpdateKillQuota; TurnHandler.waveUpdate += UpdateRounds; } private void UpdateKillQuota(Entity entity) { if (entity == thisEntity) { currentKills++; currentKills = Mathf.Clamp(currentKills, 0, killQuota); } } private void UpdateRounds() { if (roundsRemaining > 0) { roundsRemaining--; if (roundsRemaining <= 0) { DeactivateAbility(); } } } public override void TryAbility() { if (currentKills >= killQuota) { currentKills = 0; roundsRemaining = abilityLength; AbilityEffects(); } } protected virtual void DeactivateAbility() { } }