예제 #1
0
    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();
            }
        }
    }
예제 #2
0
    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();
            }
        }
    }
예제 #3
0
    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();
                }
            }
        }
    }
예제 #4
0
    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();
            }
        }
    }
예제 #5
0
    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();
            }
        }
    }
예제 #6
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();
            }
        }
    }
예제 #7
0
    private IEnumerator PlayTurnRoutine()
    {
        if (gameManager != null && !gameManager.IsGameOver)
        {
            enemieSensor.UpdateSensor();

            yield return(null);

            if (enemieSensor.FoundPlayer)
            {
                yield return(StartCoroutine(Kill()));
            }
            else
            {
                enemyMover.MoveOneTurn();
            }
        }
    }
예제 #8
0
    private IEnumerator PlayTurnRoutine()
    {
        if (m_gameManager != null && m_gameManager.IsGameOver)
        {
            m_enemySenor.UpdateSensor();

            yield return(new WaitForSeconds(0f));

            if (m_enemySenor.FoundPlayer)
            {
                //attack

                m_gameManager.LoseLevel();
            }
            else
            {
                m_enemyMover.MoveOneTurn();
            }
        }
    }
예제 #9
0
    // 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();
            }
        }
    }
예제 #10
0
    IEnumerator PlayTurnRoutine()
    {
        if (m_gameManager != null && !m_gameManager.IsGameOver)
        {
            //detect player
            m_enemySensor.UpdateSensor(m_enemyMover.CurrentNode);

            yield return(new WaitForSeconds(0f));

            if (m_enemySensor.FoundPlayer && isScared == false)
            {
                //attack player
                //notify the GM to lose the level

                m_gameManager.LoseLevel();
            }
            else
            {
                // movement
                m_enemyMover.MoveOneTurn(); // --> finishMovementEvent.Invoke()
            }
        }
    }
예제 #11
0
    // 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();
            }
        }
    }
예제 #12
0
    IEnumerator PlayTurnRoutine()
    {
        if (m_gameManager != null && !m_gameManager.IsGameOver)
        {
            //detect player
            m_enemySensor.UpdateSensor(m_enemyMover.CurrentNode);

            yield return(new WaitForSeconds(0f));

            if (m_enemySensor.FoundPlayer && isOff == false)
            {
                //attack player
                //notify the GM to lose the level
                //lr.transform.gameObject.SetActive(true);
                Debug.Log(this.name + "MORTE");
                m_gameManager.LoseLevel();
            }
            else
            {
                // movement
                m_enemyMover.MoveOneTurn(); // --> finishMovementEvent.Invoke()
            }
        }
    }