protected override void PreExecute(StateManager manager) { EnemyCharController enemy = manager.Get <EnemyStateManager>().GetChar(); NavMeshAgent nav = enemy.GetComponent <NavMeshAgent>(); Debug.Log("START "); }
public override void Execute(StateManager manager) { EnemyCharController enemy = manager.Get <EnemyStateManager>().GetChar(); NavMeshAgent nav = enemy.GetComponent <NavMeshAgent>(); nav.speed = 200; nav.SetDestination(enemy.GetPlayer().transform.position); }
protected override void PostExecute(StateManager manager) { EnemyCharController enemy = manager.Get <EnemyStateManager>().GetChar(); NavMeshAgent nav = enemy.GetComponent <NavMeshAgent>(); nav.speed = 0; nav.SetDestination(new Vector3()); Debug.Log("END "); }
IEnumerator CastDamage(EnemyCharController damageable) { while (true) { yield return(new WaitForSeconds(applyEveryNSeconds)); if (appliedTimes >= applyDamageNTimes) { damageable.stunned = false; Debug.Log("enemy able to fire again"); break; } if (!test && appliedTimes <= applyDamageNTimes || !test && applyEveryNSeconds == 0) { test = true; damageable.stunned = true; appliedTimes++; test = false; } } }