예제 #1
0
    //設定狀態
    public void SetState(GameFlowState State, MainGameStateControl m_MainGameStateController)
    {
        GameState   = State;
        m_bRunBegin = false;

        if (m_State != null)
        {
            m_State.StateEnd();
        }

        //設定State
        switch (State)
        {
        case GameFlowState.Init:
            m_State = new InitState(m_MainGameStateController);
            break;

        case GameFlowState.DriveForkKit:
            m_State = new DriveForkleftState(m_MainGameStateController);
            break;

        case GameFlowState.CompleteTest:
            m_State = new CompleteTestState(m_MainGameStateController);
            break;

        case GameFlowState.CompletePrictice:
            m_State = new CompletePricticeState(m_MainGameStateController);
            break;
        }
    }
예제 #2
0
 public void OnLoadGame()
 {
     levelSelectorPanelRef.SetActive(false);
     UICanvasRef.SetActive(true);
     pointerObjectRef.SetActive(true);
     currentGameState = GameFlowState.LoadingLevel;
 }
예제 #3
0
    public void ToState(GameFlowState _state)
    {
        GameObject[] grounds = GameObject.FindGameObjectsWithTag("Ground");
        state = _state;
        Debug.Log("GameFlow ToState" + _state);
        switch (state)
        {
        case GameFlowState.MANAGE:
            dataController.PutMoneyToPlayers();
            break;

        case GameFlowState.READY:
            dataController.ArangeEnemyForBoards();

            break;

        case GameFlowState.BATTLE:
            unfinishGroundCount = grounds.Length;
            break;
        }
        foreach (GameObject ground in grounds)
        {
            ChessBoardController board = ground.GetComponent <ChessBoardController> ();
            if (state == GameFlowState.BATTLE)
            {
                board.OnBattleOver += BattleOverHandler;
            }
            board.SetState(state);
        }

        PlayerController player = GameObject.Find("Player").GetComponent <PlayerController> ();

        player.SetState(state);
    }
예제 #4
0
    private void EnterGameOverState()
    {
        currentGameFlowState = GameFlowState.GameOver;
        gameOverPanel.gameObject.SetActive(true);
        gameOverScoreText.text = currentScore.ToString();

        string name = Regex.Replace(System.Environment.UserName, @"\s+", "");

        scoreboardManager.PostScore(name, currentScore);
    }
예제 #5
0
    void LoadSelectedLevel()
    {
        int mapId = getIndexMapAssetToLoad();

        if (!MapManager.Instance.TrySelectMapById(mapId))
        {
            Debug.LogErrorFormat("Couldn't select map with Id {0}", mapId);
            return;
        }

        currentGameState = GameFlowState.LoadingLevel;
        GameEvents.GameState.OnLoadGame.SafeInvoke();
    }
예제 #6
0
        public void SetState(GameFlowState _state)
        {
            switch (_state)
            {
            case GameFlowState.MANAGE:
                StopBattle();
                break;

            case GameFlowState.READY:
                ReadyBattle();
                break;

            case GameFlowState.BATTLE:
                StartBattle();
                break;
            }
        }
예제 #7
0
    private void ChangeState(GameFlowState newState)
    {
        switch (currentGameFlowState)
        {
        case GameFlowState.StartMenu:
            ExitStartMenuState();
            break;

        case GameFlowState.Playing:
            ExitPlayingState();
            break;

        case GameFlowState.GameOver:
            ExitGameOverState();
            break;

        case GameFlowState.ScoreBoard:
            ExitScoreBoardState();
            break;

        default:
            break;
        }
        switch (newState)
        {
        case GameFlowState.StartMenu:
            EnterStartMenuState();
            break;

        case GameFlowState.Playing:
            EnterPlayingState();
            break;

        case GameFlowState.GameOver:
            EnterGameOverState();
            break;

        case GameFlowState.ScoreBoard:
            EnterScoreBoardState();
            break;

        default:
            break;
        }
    }
예제 #8
0
        public void SetState(GameFlowState state)
        {
            string ext = "";

            switch (state)
            {
            case GameFlowState.MANAGE:
                ext = "现在是排兵布阵阶段";
                break;

            case GameFlowState.READY:
                ext = "现在是即将开始阶段";
                break;

            case GameFlowState.BATTLE:
                ext = "ima是Battle阶段";
                break;
            }
            SetCountText(ext);
        }
예제 #9
0
 private void EnterScoreBoardState()
 {
     currentGameFlowState = GameFlowState.ScoreBoard;
     scoreboardPanel.gameObject.SetActive(true);
     RetrieveScoresFromServer();
 }
예제 #10
0
 private void EnterPlayingState()
 {
     currentGameFlowState = GameFlowState.Playing;
     playingPanel.gameObject.SetActive(true);
     this.Initialise();
 }
예제 #11
0
 private void EnterStartMenuState()
 {
     currentGameFlowState = GameFlowState.StartMenu;
     startMenuPanel.gameObject.SetActive(true);
 }
예제 #12
0
 public void OnGameEnded()
 {
     currentGameState = GameFlowState.ScorePanel;
 }
예제 #13
0
 //Start
 private void Start()
 {
     currentGameState = GameFlowState.LevelSelect;
 }
예제 #14
0
 public void StartGame()
 {
     GameEvents.GameState.OnStartGame.SafeInvoke();
     currentGameState = GameFlowState.inGame;
 }