示例#1
0
    /// <summary>
    /// Executes a method after StateListener captures a change on currentBattleState variable
    /// </summary>
    /// <param name="newBattleState">The new BattleState value</param>

    /*void OnBattlestateChange(BattleState newBattleState) {
     * //        Debug.Log("Changing state to: " + newBattleState.ToString());
     *
     *  switch (newBattleState) {
     *
     *      case BattleState.battleStart:
     *          //Debug.Log("Battle initial setup");
     *          //Showing enemy name and area
     *          break;
     *
     *      case BattleState.battle:
     *          //Debug.Log("Starting battle");
     *
     *          //Unpauses the game
     *          if (isGamePaused) {
     *              isGamePaused = false;
     *              Pause(isGamePaused);
     *          }
     *
     *          //StandBy
     *          battleHud.ShowStandBy(false);
     *
     *          //Battle
     *          battleHud.ShowCustomBar(true);
     *          battleHud.ShowBattleChipHelp(true);
     *
     *          GameObject.Find("Gamestate").SendMessage("ActivateCustomGauge", true);
     *          break;
     *
     *      case BattleState.selectionScreen:
     * //                Debug.Log("Displaying Selection screen");
     *          battleHud.ShowCustomBar(false);
     *          battleHud.ShowBattleChipHelp(false);
     *          battleHud.ShowSelectionScreen(true);
     *
     *          //Destroying chip guides
     *          DestroyChipBattleScreen(1);
     *          DestroyChipBattleScreen(2);
     *          DestroyChipBattleScreen(3);
     *          DestroyChipBattleScreen(4);
     *
     *          //Refreshing chip list
     *          GameObject.Find("Folder").SendMessage("SetSelectionScreenChips");
     *
     *          //Setting time to zero
     *          Time.timeScale = 0.0f;
     *          break;
     *
     *      case BattleState.standby:
     *          //Debug.Log("Standing by...");
     *          ChangeToStandBy();
     *          break;
     *
     *      case BattleState.pause:
     *          //Debug.Log("Game paused");
     *          isGamePaused = true;
     *          Pause(isGamePaused);
     *          break;
     *
     *      case BattleState.results:
     *          //Stoping custom gauge
     *          GameObject.Find("Gamestate").SendMessage("ActivateCustomGauge", false);
     *          battleHud.ShowSelectionScreen(false);
     *
     *          //Ending battle
     *          //Debug.Log("Battle has ended, showing results screen");
     *          battleHud.ShowResultsScreen();
     *
     *          //Changing to restart
     *          StartCoroutine(ChangeToRestart());
     *          break;
     *  }
     * }*/

    /// <summary>
    /// Executes a method after StateListener captures a change on currentBattleState variable
    /// </summary>
    /// <param name="newBattleState">The new BattleState value</param>
    public void ChangeBattleState(BattleState newBattleState)
    {
        //        Debug.Log("Changing state to: " + newBattleState.ToString());

        currentBattleState = newBattleState;

        switch (newBattleState)
        {
        case BattleState.battleStart:
            Debug.Log("Battle initial setup");
            //Showing enemy name and area
            break;

        case BattleState.battle:
            Debug.Log("Starting battle");

            //Unpauses the game
            if (isGamePaused)
            {
                isGamePaused = false;
                Pause(isGamePaused);
            }

            //StandBy
            battleHud.ShowStandBy(false);

            //Battle
            battleHud.ShowCustomBar(true);
            battleHud.ShowBattleChipHelp(true);

            GameObject.Find("Gamestate").SendMessage("ActivateCustomGauge", true);
            break;

        case BattleState.selectionScreen:
            //                Debug.Log("Displaying Selection screen");
            battleHud.ShowCustomBar(false);
            battleHud.ShowBattleChipHelp(false);
            battleHud.ShowSelectionScreen(true);

            //Destroying chip guides
            DestroyChipBattleScreen(1);
            DestroyChipBattleScreen(2);
            DestroyChipBattleScreen(3);
            DestroyChipBattleScreen(4);

            //Refreshing chip list
            GameObject.Find("Folder").SendMessage("SetSelectionScreenChips");

            //Setting time to zero
            Time.timeScale = 0.0f;
            break;

        case BattleState.standby:
            Debug.Log("Standing by...");
            ChangeToStandBy();
            break;

        case BattleState.pause:
            Debug.Log("Game paused");
            isGamePaused = true;
            Pause(isGamePaused);
            break;

        case BattleState.results:
            //Stoping custom gauge
            GameObject.Find("Gamestate").SendMessage("ActivateCustomGauge", false);
            battleHud.ShowSelectionScreen(false);

            //Ending battle
            Debug.Log("Battle has ended, showing results screen");
            battleHud.ShowResultsScreen();

            //Changing to restart
            StartCoroutine(ChangeToRestart());
            break;
        }
    }