Ejemplo n.º 1
0
    void FixedUpdate()
    {
        if (!gamePause)
        {
            if (roundStart)
            {
                if (!roundOver)
                {
                    switch (roundState)
                    {
                    case roundStateEnum.CharacterSelect:
                        currentPlayer = characters.Dequeue();
                        if (currentPlayer.activeInHierarchy)
                        {
                            roundState = roundStateEnum.CharacterTurn;
                            if (currentPlayer.tag == "Player")
                            {
                                gameMap.initialPlayerTurn(currentPlayer);
                                playerRound = playerStates.playerBase;
                            }
                            else
                            {
                                gameMap.initialEnemyTurn(currentPlayer);
                            }
                            mainCamera.GetComponent <CameraMovementBattle>().moveCamera(currentPlayer.transform.position);
                        }
                        else
                        {
                            roundState = roundStateEnum.CharacterEnd;
                        }
                        break;

                    case roundStateEnum.CharacterTurn:
                        if (currentPlayer.tag == "Player")
                        {
                            switch (playerRound)
                            {
                            case playerStates.playerBase:
                                roundState = gameMap.playerTurn(currentPlayer);
                                break;

                            case playerStates.playerMove:
                                roundState = gameMap.playerTurnMove(currentPlayer);
                                break;

                            case playerStates.playerAttack:
                                roundState = gameMap.playerTurnAttack(currentPlayer);
                                break;
                            }
                        }
                        else
                        {
                            roundState = gameMap.enemyTurn(currentPlayer);
                        }
                        break;

                    case roundStateEnum.Movement:
                        roundState = gameMap.moveAlongPath(currentPlayer);
                        mainCamera.GetComponent <CameraMovementBattle>().moveCamera(currentPlayer.transform.position);
                        break;

                    case roundStateEnum.EnemyMovement:
                        roundState = gameMap.moveAlongPath(currentPlayer);
                        mainCamera.GetComponent <CameraMovementBattle>().moveCamera(currentPlayer.transform.position);
                        break;

                    case roundStateEnum.EnemyPause:
                        if (timer > enemyPauseTime)
                        {
                            roundState = prevState;
                        }
                        else
                        {
                            timer += Time.deltaTime;
                            mainCamera.GetComponent <CameraMovementBattle>().moveCamera(currentPlayer.transform.position);
                        }
                        break;

                    case roundStateEnum.CharacterEnd:
                        gameMap.resetMap();
                        roundState = roundStateEnum.CharacterSelect;
                        characters.Enqueue(currentPlayer);
                        bool playersAlive = gameMap.checkPlayers();
                        bool enemiesAlive = gameMap.checkEnemies();
                        if (!playersAlive || !enemiesAlive)
                        {
                            roundOver = true;
                        }
                        break;

                    case roundStateEnum.SpecialEvent:
                        break;
                    }
                }
                else
                {
                    //Round Over
                    Application.Quit();
                }
            }
        }
    }
Ejemplo n.º 2
0
 public void enemyWait(roundStateEnum nextState)
 {
     prevState = nextState;
     timer     = 0;
 }