async public virtual Task Move() { alertMoveCalled++; if (stateMachine.GetEnemyState() == EnemyStates.IDLE) { int nextNodeID = pathService.GetNextNodeID(currentNodeID, spawnDirection); await MoveToNextNode(nextNodeID); await currentEnemyView.RotateEnemy(GetRotation(spawnDirection)); } else if (stateMachine.GetEnemyState() == EnemyStates.CHASE || stateMachine.GetEnemyState() == EnemyStates.CONSTANT_CHASE) { int nextNodeID = alertedPathNodes[alertMoveCalled]; if (pathService.CanEnemyMoveToNode(currentNodeID, nextNodeID)) { await MoveToNextNode(nextNodeID); await currentEnemyView.RotateEnemy(GetRotation(spawnDirection)); } if (alertMoveCalled == alertedPathNodes.Count - 1) { stateMachine.ChangeEnemyState(EnemyStates.IDLE); currentEnemyView.DisableAlertView(); } } await new WaitForEndOfFrame(); }