private IEnumerator PlayTurnRoutine() { if (m_gameManager != null) { if (!m_gameManager.IsGameOver) { m_enemySensor.UpdateSensor(m_enemyMover.CurrentNode); yield return(new WaitForSeconds(0.0f)); if (m_enemySensor.FoundPlayer) { m_gameManager.LoseLevel(); Vector3 playerPosition = new Vector3(m_board.PlayerNode.Coordinate.x, 0.0f, m_board.PlayerNode.Coordinate.y); m_enemyMover.Move(playerPosition, 0.0f); while (m_enemyMover.isMoving) { yield return(null); } m_enemyAttack.Attack(); } else { m_enemyMover.MoveOneTurn(); } } } }
IEnumerator PlayTurnRoutine() { if (m_gameManager != null && m_gameManager.IsGameOver) { // detect player m_enemySensor.UpdateSensor(m_enemyMover.CurrentNode); // wait yield return(new WaitForSeconds(0f)); if (m_enemySensor.FoundPlayer) { // notify the GameManager to lose the level m_gameManager.LoseLevel(); Vector3 playerPosition = new Vector3(m_board.PlayerNode.Coordinate.x, 0f, m_board.PlayerNode.Coordinate.y); m_enemyMover.Move(playerPosition, 0f); while (m_enemyMover.isMoving) { yield return(null); } // attack player m_enemyAttack.Attack(); } else { //movement m_enemyMover.MoveOneTurn(); } } }
IEnumerator PlayTurnRoutine() { if (_gameManager != null && !_gameManager.IsGameOver) { //detect player _enemySensor.UpdateSensor(_enemyMover.CurrentNode); //wait yield return(new WaitForSeconds(0f)); if (_enemySensor.FoundPlayer) { //notify GameManager to lose event _gameManager.LoseLevel(); Vector3 playerPosition = _board.PlayerNode.coordinate; _enemyMover.Move(playerPosition); while (_enemyMover.isMoving) { yield return(null); } //attack player _enemyAttack.Attack(); } else { //move _enemyMover.MoveOneTurn(); } } }
private void Update() { if (dying) { return; } _input.BlockInput = _animator.GetBool("BlockInput"); _state._frozen = _animator.GetBool("BlockInput"); var moveInput = _state._frozen ? Vector2.zero : _input.GetMovingDirection(); _mover.Move(moveInput); _animator.SetFloat("XSpeed", moveInput.x); var aimInput = _state._frozen ? Vector2.zero : _input.GetAimingDirection(); if (aimInput.x != 0) { _animator.FlipX = aimInput.x > 0; _state._facingRight = aimInput.x > 0; } var backward = _state._facingRight != aimInput.x > 0; _animator.SetBool("Backward", backward); }
IEnumerator PlayTurnRoutine() { if (gameManager != null && !gameManager.IsGameOver) { enemySensor.UpdateSensor(CurrentNode); yield return(new WaitForSeconds(endTurnDelay)); Debug.Log(enemySensor.FoundPlayer); if (enemySensor.FoundPlayer) { gameManager.LoseLevel(); Vector3 playerPos = board.PlayerNode.transform.position; enemyMover.Move(playerPos, 0f); while (enemyMover.IsMoving) { yield return(null); } enemyAttack.Attack(); } else { enemyMover.MoveOneTurn(); } } }
private IEnumerator PlayTurnRoutine() { if (m_GameManager != null && !m_GameManager.IsGameOver) { m_enemySensor.SenseNode(m_enemyMover.CurrentNode); yield return(new WaitForSeconds(0.0f)); if (m_enemySensor.FindPlayer) { m_GameManager.LoseLevel(); Vector3 playPos = new Vector3(m_board.PlayerNode.Coordinate.x, 0f, m_board.PlayerNode.Coordinate.y); m_enemyMover.Move(playPos, 0f); while (m_enemyMover.isMoving) { yield return(null); } //attach player m_enemyAttack.Attack(); } else { //move m_enemyMover.MoveOneTurn(); } } }
IEnumerator PlayTurnRoutine() { m_enemyMover.Move(); yield return(new WaitForSeconds(.5f)); FinishTurn(); }
public virtual IEnumerator Kill() { gameManager.LoseLevel(); var playerPos = new Vector3(board.PlayerNode.Coordinate.x, 0f, board.PlayerNode.Coordinate.y); enemyMover.Move(playerPos, 0f); while (enemyMover.IsMoving) { yield return(null); } enemyAttack.Attack(); }
// emeny's main routine. if its possible to attack the player, move then wait IEnumerator PlayTurnRoutine() { if (m_gameManager != null && !m_gameManager.IsGameOver) { // sense for the player m_enemySensor.UpdateSensor(); // wait yield return(new WaitForSeconds(0f)); if (m_enemySensor.FoundPlayer) { // signal to the game manager to run the lose level event m_gameManager.LoseLevel(); // the player's position at this point Vector3 playerPosition = new Vector3(m_board.PlayerNode.Coordinate.x, 0f, m_board.PlayerNode.Coordinate.y); // move to where the Player currently is m_enemyMover.Move(playerPosition, 0f); // wait until the end of the enemy iTween animation while (m_enemyMover.isMoving) { yield return(null); } // lunge at the player m_enemyAttack.Attack(); } else { // carry out movement m_enemyMover.MoveOneTurn(); } } }
IEnumerator PlayTurnRoutine() { if (m_gameManager != null && !m_gameManager.IsGameOver) { m_enemySensor.UpdateSensor(); yield return(new WaitForSeconds(0f)); if (m_enemySensor.FoundPlayer) { if (godMode == null || (godMode != null && !godMode.IsGodModeActive)) { m_gameManager.LoseLevel(); } Vector3 playerPosition = new Vector3(m_board.PlayerNode.Coordinate.x, 0f, m_board.PlayerNode.Coordinate.y); m_enemyMover.Move(playerPosition, 0f); while (m_enemyMover.isMoving) { yield return(null); } if (godMode == null || (godMode != null && !godMode.IsGodModeActive)) { m_enemyAttack.Attack(); } if (godMode != null && godMode.IsGodModeActive) { m_enemyMover.Stand(); } } else { m_enemyMover.MoveOneTurn(); } } }
// main enemy routine: detect/attack Player if possible...then move/wait IEnumerator PlayTurnRoutine() { if (m_gameManager != null && !m_gameManager.IsGameOver) { // detect player m_enemySensor.UpdateSensor(); // wait yield return(new WaitForSeconds(0f)); if (m_enemySensor.FoundPlayer) { // notify the GameManager to lose the level m_gameManager.LoseLevel(); // the player's position Vector3 playerPosition = new Vector3(m_board.PlayerNode.Coordinate.x, 0f, m_board.PlayerNode.Coordinate.y); // move to the Player's position m_enemyMover.Move(playerPosition, 0f); // wait for the enemy iTween animation to finish while (m_enemyMover.isMoving) { yield return(null); } // attack/kill player m_enemyAttack.Attack(); } else { // movement m_enemyMover.MoveOneTurn(); } } }