Esempio n. 1
0
    private void Update()
    {
        if (player.GetButtonDown("DPadRight") || (player.GetAxis("Left Leg Horizontal") > kMenuDeadZone && player.GetAxisPrev("Left Leg Horizontal") <= kMenuDeadZone))
        {
            MoveLetterInput(1);
        }
        else if (player.GetButtonDown("DPadLeft") || (player.GetAxis("Left Leg Horizontal") < -kMenuDeadZone && player.GetAxisPrev("Left Leg Horizontal") >= -kMenuDeadZone))
        {
            MoveLetterInput(-1);
        }
        else if (player.GetButtonDown("Start Game"))
        {
            if (currentInputState == InputState.fourthLetter)
            {
                LeaderboardDataManager leaderboardDataManager;
                if (LeaderboardDataManager.TryGetInstance(out leaderboardDataManager))
                {
                    string condensedString = firstLetter.character.text + secondLetter.character.text + thirdLetter.character.text + fourthLetter.character.text;
                    string scoreString     = scoreText.text;
                    for (int i = 0; i < 4 - (scoreText.text.Length - 1); i++)
                    {
                        scoreString += "0";
                    }
                    leaderboardDataManager.AddHighScore(condensedString, scoreString);
                }

                IntegrityManager integrityManager;
                if (IntegrityManager.TryGetInstance(out integrityManager))
                {
                    LeaderboardPositionManager leaderboardPositionManager;
                    if (LeaderboardPositionManager.TryGetInstance(out leaderboardPositionManager))
                    {
                        leaderboardPositionManager.SetTargetLeaderboardPosition(leaderboardPositionManager.showAllPosition);
                    }

                    integrityManager.EndGame();
                    GameManager gameManager;
                    if (GameManager.TryGetInstance(out gameManager))
                    {
                        gameManager.OnFinishedEnteringHighScore();
                    }
                    gameObject.SetActive(false);
                }
            }
            else
            {
                MoveLetterInput(1);
            }
        }
    }
Esempio n. 2
0
    private void Update()
    {
        if (!waitingForInvoke)
        {
            switch (gameState)
            {
            case GameState.Playing:

                currentTime += Time.deltaTime;


                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    currentTime += 60f;
                }
                else if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    currentTime -= 30f;
                }
                else if (Input.GetKeyDown(KeyCode.Space))
                {
                    currentIntegrity = 0;
                }


                UpdateUI();
                UpdateSpawners();

                if (player.GetButtonUp("Pause"))
                {
                    PauseGame();
                }

                if (currentIntegrity <= 0)
                {
                    DestroyAllRecords();
                    waitingForInvoke = true;
                    allThatIsGoodIsNasty.gameObject.SetActive(true);
                    timer.gameObject.SetActive(false);
                    spawnerLeft.SetActive(false);
                    spawnerRight.SetActive(false);
                    LeaderboardPositionManager leaderboardPositionManager;
                    if (LeaderboardPositionManager.TryGetInstance(out leaderboardPositionManager))
                    {
                        leaderboardPositionManager.SetLeaderboardPosition(leaderboardPositionManager.showInputPosition);
                    }
                    Invoke("SendAllThatIsGoodIsNasty", allThatIsGoodIsNastyLoopTime);
                    Invoke("EnterScore", endGamePause);
                }

                break;

            case GameState.End:
                break;

            case GameState.Paused:
                if (player.GetButtonUp("Restart"))
                {
                    UnpauseGame();
                }
                else if (player.GetButtonUp("Resume"))
                {
                    GameManager gameManager;
                    if (GameManager.TryGetInstance(out gameManager))
                    {
                        gameManager.TransitionFromPause();
                    }

                    pauseMenuButtonPromptAB.SetTrigger("outTrigger");
                    TurnOffTimerGameObjects();
                    EndGame();
                }
                break;
            }
        }
    }