public override void execute(AbstractEnemyAI enemyAI) { if (enemyAI.reachedEndOfPath || enemyAI.canSeePlayer) { Executing = false; } enemyAI.AstarMoveToTarget(); }
public override void execute(AbstractEnemyAI enemyAI) { if (Executing && !conditionsMet(enemyAI)) { Executing = false; } enemyAI.AstarMoveToTarget(); if (enemyAI.reachedEndOfPath) { enemyAI.targetPosition = currentRoom.GetRandomPointInRoom(0, 0); } }
public override void execute(AbstractEnemyAI enemyAI) { // If can see player update path to player and move towards. if (enemyAI.canSeePlayer && !enemyAI.CanAttackTarget()) { if (GameManager.player == null) { return; } enemyAI.targetPosition = GameManager.player.transform.position; enemyAI.AstarMoveToTarget(); } // If reached end of path and cannot see player stop executing ChaseState. else { enemyAI.targetPosition = transform.position; Executing = false; } }