Ejemplo n.º 1
0
    // If something hits the player
    void OnTriggerEnter(Collider other)
    {
        // For the normal game
        if (cardioMode == false)
        {
            // If its the Top of the wall reload level (Eventually explode boxes and show player high-score)
            if (other.name == "SquatWallUp")
            {
                this.CheckIfEndGame();
                mostRecentWallType = "Fail";                 // For sound Effects
            }
            // If its the bottom (squatted under the wall) increase the player score
            if (other.name == "SquatWallDown")
            {
                if (checkUp.Ready == true)
                {
                    squatCardioScore++;
                    tScore.text = squatCardioScore.ToString();

                    gameModeMaster.PassedThroughWall(false);

                    // Save the total stat and check for achievements
                    AchivmentAndStatControl.IncrementStat(Constants.totalSquatWallCount);
                    int totalSquatStat = AchivmentAndStatControl.GetStat(Constants.totalSquatWallCount);
                    if (totalSquatStat != -1)
                    {
                        AchivmentAndStatControl.CheckAllTotalSquatAchivments(totalSquatStat);
                    }

                    if (PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeClassic)
                    {
                        AchivmentAndStatControl.SetStat(Constants.highestSquatConsec, squatCardioScore);                         // (Will only update stat if larger)
                        AchivmentAndStatControl.CheckAllConsecutiveSquatAchivments(squatCardioScore);
                    }

                    // If it is a normal sized squat wall make the player stand back up right away
                    if (other.transform.parent.parent == null || other.transform.parent.parent.name == "SquatWall(Clone)")
                    {
                        checkUp.Ready = false;

                        mostRecentWallType = "Single";                         // For sound Effects

                        if (arcadeMode == true)
                        {
                            scoreConsecutiveCounter += 10;
                            // Check if we got a combo, if we did it will display a combo, if not display what we just did
                            if (this.TestHighScoreConsecCounter() == false)
                            {
                                scorePopper.PopScoreMessage(0, .04f);
                                highScore.UpdateYourScore(10);
                            }
                            else
                            {
                                mostRecentWallType = "Combo";                                 // For sound Effects
                            }
                        }
                    }
                    else if (other.transform.parent.parent.name == "SquatWallx2(Clone)") // If squat wall is 2 long, allow 2
                    {
                        mostRecentWallType = "Double";                                   // For sound Effects
                        this.ResetAfterNumberOfWalls(2);
                    }
                    else                                                        // If squat wall is 3 long, allow 3
                    {
                        mostRecentWallType = "Tripple";                         // For sound Effects
                        this.ResetAfterNumberOfWalls(3);
                    }
                }
                else                 // Did not come up from a squat
                {
                    this.CheckIfEndGame();
                }
            }
        }
        else         // For cardio mode
        {
            // If the player hits the wall
            if (other.name == "CardioWallSolid")
            {
                this.CheckIfEndGame();
            }
            // If the player goes through the open spot
            if (other.name == "CardioWallOpen")
            {
                squatCardioScore++;
                tScore.text = squatCardioScore.ToString();

                if (arcadeMode == true)
                {
                    scoreConsecutiveCounter += 10;
                    // Check if we got a combo, if we did it will display a combo, if not display what we just did
                    if (this.TestHighScoreConsecCounter() == false)
                    {
                        scorePopper.PopScoreMessage(0, .04f);
                        highScore.UpdateYourScore(10);
                    }
                    else
                    {
                        mostRecentWallType = "Combo";                         // For sound Effects
                    }
                }

                gameModeMaster.PassedThroughWall(true);

                // Save the total stat and check for achievements
                AchivmentAndStatControl.IncrementStat(Constants.totalCardioWallCount);
                int totalCardioStats = AchivmentAndStatControl.GetStat(Constants.totalCardioWallCount);
                if (totalCardioStats != -1)
                {
                    AchivmentAndStatControl.CheckAllTotalCardioAchivments(totalCardioStats);
                }

                if (PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeClassic)
                {
                    // Check if we have reached any consecutive achievements and set stat
                    AchivmentAndStatControl.SetStat(Constants.highestCardioConsec, squatCardioScore);                     // (Will only update stat if larger)
                    AchivmentAndStatControl.CheckAllConsecutiveCardioAchivments(squatCardioScore);
                }
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Destroy all walls and end the game
    /// </summary>
    public void EndGame(bool viaPauseMenu = false)
    {
        // If we have already done the ending stuff return out
        if (gameOver == true)
        {
            return;
        }

        //// If we are in classic mode, update the consecutive cardio
        //if (PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeClassic)
        //{
        //	if (PlayerPrefs.GetInt(Constants.cardioMode) == 1)
        //	{
        //		// Check if we have reached any consecutive achievements and set stat
        //		AchivmentAndStatControl.SetStat(Constants.highestCardioConsec, squatCardioScore); // (Will only update stat if larger)
        //		AchivmentAndStatControl.CheckAllConsecutiveCardioAchivments(squatCardioScore);
        //	}
        //	else
        //	{
        //		AchivmentAndStatControl.SetStat(Constants.highestSquatConsec, squatCardioScore); // (Will only update stat if larger)
        //		AchivmentAndStatControl.CheckAllConsecutiveSquatAchivments(squatCardioScore);
        //	}
        //}

        // Save Score if in classic mode or if in daily challenge
        if (PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeClassic || PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeDaily)
        {
            SteamLeaderBoardUpdater.UpdateLeaderBoard(squatCardioScore);
        }

        // If arcade, update based on the score
        if (PlayerPrefs.GetInt(Constants.gameMode) == Constants.gameModeArcade)
        {
            // Save score to steam leader board
            int currScore = highScore.GetYourScore();
            SteamLeaderBoardUpdater.UpdateLeaderBoard(currScore);
            AchivmentAndStatControl.SetStat(Constants.highScore, currScore);

            // Dont enable the player score pop up
            if (viaPauseMenu == false)
            {
                // Pop up the name select
                ArcadeNameSelector nameSelector = GameObject.Find("ArcadeNameSelector").GetComponent <ArcadeNameSelector>();
                nameSelector.SetPlayerScore(currScore);
                nameSelector.SetToSize();
            }

            // Prevent loading level so we can pick name
            GameObject.Find("GameModeMaster").GetComponent <GameModeMaster>().PreventLevelFromLoading = true;
        }

        if (GameObject.Find("GYM") != null)
        {
            Transform st = GameObject.Find("GYM").transform.Find("SquatTrack");
            st.Find("SquatBars").GetComponent <GuideRail>().LowerRail();
            st.Find("DoorA").GetComponent <SquatTrackDoor>().CloseDoor();
            st.Find("DoorB").GetComponent <SquatTrackDoor>().CloseDoor();
        }

        // Disable hand block so it doesnt get in your way
        this.EnableDisableHands(false);

        // Gib all walls
        this.DestroyAllWalls(!viaPauseMenu);

        // Let the arcade mode handle ending the game if we are in arcade mode
        GameModeMaster gameMaster = GameObject.Find("GameModeMaster").GetComponent <GameModeMaster>();

        gameMaster.EndGame();

        gameOver = true;
    }