Пример #1
0
        public void OperatorEquals_BothNull_True()
        {
            GameUIState state1 = null;
            GameUIState state2 = null;

            Assert.IsTrue(state1 == state2);
        }
    public void UnPause()
    {
        Time.timeScale = 1;

        AdjustAudioVolume(volumeSlider.value);
        UIState = GameUIState.INGAME;
    }
Пример #3
0
        public void OperatorNotEquals_BothNull_False()
        {
            GameUIState state1 = null;
            GameUIState state2 = null;

            Assert.IsFalse(state1 != state2);
        }
    public void StartGame()
    {
        // Reset status
        hasWon = false;

        SceneManager.LoadScene(gameSceneName);
        UIState = GameUIState.INGAME;
    }
Пример #5
0
        public void UpdateState(GameUIState state)
        {
            Menu.Set(state == GameUIState.MainMenu);
            GameOver.Set(state == GameUIState.GameOver);
            Game.Set(state == GameUIState.Game);

            _lastState = state;
        }
    public void GoToMenu()
    {
        UnPause();
        panels.ShowGameOverPanel(false);
        SceneManager.LoadScene(0);

        UIState = GameUIState.MAINMENU;
    }
Пример #7
0
        public void OperatorNotEquals_OneNull_True()
        {
            GameObject  gameObject = new GameObject();
            GameScreen  screen     = gameObject.AddComponent <GameScreen>();
            GameUIState state1     = new MoveState(screen);
            GameUIState state2     = null;

            Assert.IsTrue(state1 != state2);
        }
Пример #8
0
        public void OperatorNotEquals_SameReference_False()
        {
            GameObject  gameObject = new GameObject();
            GameScreen  screen     = gameObject.AddComponent <GameScreen>();
            GameUIState state1     = new MoveState(screen);
            GameUIState state2     = state1;

            Assert.IsFalse(state1 != state2);
        }
Пример #9
0
        public static void Display(GameUIState ui)
        {
            if (ui == GameUIState.Clear)
                title = Game1.content.Load<Texture2D>("Sprites/stage_clear");
            else if (ui == GameUIState.Died)
                title = Game1.content.Load<Texture2D>("Sprites/died");

            enabled = true;
        }
Пример #10
0
        public static void Display(GameUIState ui)
        {
            if (ui == GameUIState.Clear)
            {
                title = Game1.content.Load <Texture2D>("Sprites/stage_clear");
            }
            else if (ui == GameUIState.Died)
            {
                title = Game1.content.Load <Texture2D>("Sprites/died");
            }

            enabled = true;
        }
Пример #11
0
    public void ShowWithOption(GameUIState i)
    {
        base.Show();

        if (i == GameUIState.InGame)
        {
            LeaveChannelBtn.gameObject.SetActive(true);
            LeaveRoomBtn.gameObject.SetActive(false);
        }
        else if (i == GameUIState.Lobby)
        {
            LeaveChannelBtn.gameObject.SetActive(false);
            LeaveRoomBtn.gameObject.SetActive(true);
        }
    }
Пример #12
0
    void SetUIState(GameUIState uiState)
    {
        GameObject previousCurrentPage = currentPage;

        switch (uiState)
        {
        case GameUIState.Playing:
            gameState.state = GameState.State.playing;
            currentPage     = null;
            break;

        case GameUIState.Start:
            gameState.state = GameState.State.notPlaying;
            currentPage     = startPage;
            break;

        case GameUIState.GameOver:
            gameState.state = GameState.State.notPlaying;
            currentPage     = gameOverPage;
            break;

        case GameUIState.Countdown:
            gameState.state = GameState.State.notPlaying;
            currentPage     = countDownPage;
            break;

        case GameUIState.GamePaused:
            gameState.state = GameState.State.paused;
            currentPage     = pausePage;
            break;
        }

        if (previousCurrentPage != currentPage)
        {
            previousCurrentPage?.SetActive(false);
            currentPage?.SetActive(true);
        }
    }
Пример #13
0
    private void SetPanelActive(GameUIState newState, bool newActive)
    {
        switch (newState)
        {
        case GameUIState.EMPTY:
            break;

        case GameUIState.GAME_LOBBY:
            _startGameMenuPanel.SetActive(newActive);
            break;

        case GameUIState.INGAME:
            break;

        case GameUIState.COUNTDOWN:
            _countdownPanel.SetActive(newActive);
            break;

        case GameUIState.LOCAL_LOBBY:
            _connectionPanel.SetActive(newActive);
            break;
        }
    }
    void Update()
    {
        switch (UIState)
        {
        case GameUIState.MAINMENU:
            if (Input.GetButtonDown("Cancel"))
            {
                ExitGame();
            }

            break;

        case GameUIState.INGAME:
            if (Input.GetButtonDown("Cancel"))
            {
                panels.ShowPausePanel(true);

                //Call the DoPause function to pause the game
                DoPause();
            }

            if (player)
            {
                if (player.IsDead())
                {
                    Timer timing = GameObject.FindObjectOfType <Timer> ();
                    if (timing)
                    {
                        playerTime = string.Format("{0:00} : {1:00} AM", timing.minutes, timing.seconds);
                    }

                    UIState = GameUIState.GAMEOVER;
                }
            }

            break;

        case GameUIState.PAUSED:
            mixer.SetFloat("MasterVolume", -80);

            if (Input.GetButtonDown("Cancel"))
            {
                panels.ShowPausePanel(false);

                //Call the UnPause function to unpause the game
                UnPause();
            }

            break;

        case GameUIState.GAMEOVER:
            if (hasWon)
            {
                mixer.SetFloat("MelodyVolume", 0);
                mixer.SetFloat("HorrorVolume", -80);
            }
            else
            {
                mixer.SetFloat("MelodyVolume", -80);
                mixer.SetFloat("HorrorVolume", 0);
            }
            mixer.SetFloat("NoiseVolume", -80);

            GamingOver();
            panels.ShowGameOverPanel(true);

            if (Input.GetButtonDown("Cancel"))
            {
                panels.ShowPausePanel(true);

                //Call the DoPause function to pause the game
                DoPause();
            }

            break;
        }
    }
Пример #15
0
        private void setGameUIState(GameUIState newState)
        {
            gameUiState = newState;

            switch (newState)
            {
                case GameUIState.WaitingCalibration:
                    addPlayerButton.Enabled = false;
                    resetButton.Enabled = false;
                    nextButton.Enabled = false;
                    editButton.Enabled = false;
                    newGameButton.Enabled = false;
                    newGameButton.Text = "New";
                    statusLabel.Text = "Calibration required";
                    break;

                case GameUIState.NewGame:
                    addPlayerButton.Enabled = true;
                    resetButton.Enabled = false;
                    nextButton.Enabled = false;
                    editButton.Enabled = false;
                    newGameButton.Enabled = true;
                    newGameButton.Text = "Start";
                    statusLabel.Text = "Add players or press start";
                    break;

                case GameUIState.AddedPlayer:
                    addPlayerButton.Enabled = true;
                    resetButton.Enabled = false;
                    nextButton.Enabled = false;
                    editButton.Enabled = false;
                    newGameButton.Enabled = true;
                    newGameButton.Text = "Start";
                    statusLabel.Text = "Added '" + Controller.Game.Players[Controller.Game.Players.Count-1].Name + "'  -  Add more or start...";
                    break;

                case GameUIState.WaitingTurn:
                    addPlayerButton.Enabled = false;
                    resetButton.Enabled = true;
                    nextButton.Enabled = true;
                    editButton.Enabled = false;
                    newGameButton.Enabled = true;
                    newGameButton.Text = "New";
                    statusLabel.Text = Controller.Game.CurrentPlayer.Name + "'s turn to play...";
                    break;

                case GameUIState.Scoring:
                    addPlayerButton.Enabled = false;
                    resetButton.Enabled = true;
                    nextButton.Enabled = true;
                    editButton.Enabled = true;
                    newGameButton.Enabled = true;
                    newGameButton.Text = "New";

                    if (Controller.NewWords[0].Corrected)
                    {
                        statusLabel.Text = Controller.NewWords[0] + " scores " + Controller.NewWords[0].Points + "! (*)";
                    }
                    else
                    {
                        statusLabel.Text = Controller.NewWords[0] + " scores " + Controller.NewWords[0].Points + "!";
                    }

                    break;
            }

            updateGameTree();

            try
            {
                Controller.Game.Board.Draw(Graphics.FromImage(gameView.Image), 0, 0, gameView.Image.Width, gameView.Image.Height);
                gameView.Invalidate();
            }
            catch { }
        }
    public void DoPause()
    {
        Time.timeScale = 0;

        UIState = GameUIState.PAUSED;
    }
Пример #17
0
 public void ChangeUIState(GameUIState newState)
 {
     SetPanelActive(_currentState, false);
     SetPanelActive(newState, true);
     _currentState = newState;
 }
Пример #18
0
        private void setGameUIState(GameUIState newState)
        {
            gameUiState = newState;

            switch (newState)
            {
            case GameUIState.WaitingCalibration:
                addPlayerButton.Enabled = false;
                resetButton.Enabled     = false;
                nextButton.Enabled      = false;
                editButton.Enabled      = false;
                newGameButton.Enabled   = false;
                newGameButton.Text      = "New";
                statusLabel.Text        = "Calibration required";
                break;

            case GameUIState.NewGame:
                addPlayerButton.Enabled = true;
                resetButton.Enabled     = false;
                nextButton.Enabled      = false;
                editButton.Enabled      = false;
                newGameButton.Enabled   = true;
                newGameButton.Text      = "Start";
                statusLabel.Text        = "Add players or press start";
                break;

            case GameUIState.AddedPlayer:
                addPlayerButton.Enabled = true;
                resetButton.Enabled     = false;
                nextButton.Enabled      = false;
                editButton.Enabled      = false;
                newGameButton.Enabled   = true;
                newGameButton.Text      = "Start";
                statusLabel.Text        = "Added '" + Controller.Game.Players[Controller.Game.Players.Count - 1].Name + "'  -  Add more or start...";
                break;

            case GameUIState.WaitingTurn:
                addPlayerButton.Enabled = false;
                resetButton.Enabled     = true;
                nextButton.Enabled      = true;
                editButton.Enabled      = false;
                newGameButton.Enabled   = true;
                newGameButton.Text      = "New";
                statusLabel.Text        = Controller.Game.CurrentPlayer.Name + "'s turn to play...";
                break;

            case GameUIState.Scoring:
                addPlayerButton.Enabled = false;
                resetButton.Enabled     = true;
                nextButton.Enabled      = true;
                editButton.Enabled      = true;
                newGameButton.Enabled   = true;
                newGameButton.Text      = "New";

                if (Controller.NewWords[0].Corrected)
                {
                    statusLabel.Text = Controller.NewWords[0] + " scores " + Controller.NewWords[0].Points + "! (*)";
                }
                else
                {
                    statusLabel.Text = Controller.NewWords[0] + " scores " + Controller.NewWords[0].Points + "!";
                }

                break;
            }

            updateGameTree();

            try
            {
                Controller.Game.Board.Draw(Graphics.FromImage(gameView.Image), 0, 0, gameView.Image.Width, gameView.Image.Height);
                gameView.Invalidate();
            }
            catch { }
        }