Example #1
0
    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();
            }
        }
    }