public override Type Tick() { var chaseTarget = _fighter.CheckForAggro(); if (chaseTarget != null) { _fighter.SetTarget(chaseTarget); return(typeof(ChaseState)); } if (_fighter.Target == null) { _fighter.SetCastleTarget(); } // this should probably be a new state something like "AttackCastleState" //or "AttackBuildingState" since all fighters share similar building aggro mechanics if (_fighter.reachedEndOfPath) { _attackReadyTimer -= Time.deltaTime; if (_attackReadyTimer <= 0f) { Debug.Log("Attack!"); _fighter.Attack(); _attackReadyTimer = 1.3f; } } return(null); }
public override Type Tick() { var chaseTarget = _fighter.CheckForAggro(); if (chaseTarget != _fighter.Target) { _fighter.SetTarget(chaseTarget); return(typeof(ChaseState)); } if (_fighter.Target == null) { return(typeof(TargetCastleState)); } if (_fighter.reachedEndOfPath) { _attackReadyTimer -= Time.deltaTime; if (_attackReadyTimer <= 0f) { Debug.Log("Attack!"); _fighter.Attack(); _attackReadyTimer = 1.3f; } } return(null); }