예제 #1
0
 public void WonLevel()
 {
     //titleScreen.GetComponent <SpriteRenderer>().sprite = ;
     levelStarted = false;
     gameChoice   = GameChoice.Next;
     gameLevel++;
 }
예제 #2
0
        /// <summary>
        /// Compares player and AI choices and determines if player wins, loses or draws
        /// </summary>
        /// <param name="playerChoice"></param>
        /// <param name="AIChoice"></param>
        private void GetResult(GameChoice playerChoice, GameChoice AIChoice)
        {
            // Check if draw
            if (playerChoice == AIChoice)
            {
                // Game is draw
                _PlayerStatus = GameResult.DRAW;
            }
            else
            {
                // Find winner
                switch (playerChoice)
                {
                case GameChoice.ROCK:
                    switch (AIChoice)
                    {
                    case GameChoice.PAPER:
                        // Player loses
                        _PlayerStatus = GameResult.LOSE;
                        break;

                    case GameChoice.SCISSORS:
                        // Player wins
                        _PlayerStatus = GameResult.WIN;
                        break;
                    }
                    break;

                case GameChoice.PAPER:
                    switch (AIChoice)
                    {
                    case GameChoice.ROCK:
                        // Player wins
                        _PlayerStatus = GameResult.WIN;
                        break;

                    case GameChoice.SCISSORS:
                        // Player loses
                        _PlayerStatus = GameResult.LOSE;
                        break;
                    }
                    break;

                case GameChoice.SCISSORS:
                    switch (AIChoice)
                    {
                    case GameChoice.ROCK:
                        // Player loses
                        _PlayerStatus = GameResult.LOSE;
                        break;

                    case GameChoice.PAPER:
                        // Player wins
                        _PlayerStatus = GameResult.WIN;
                        break;
                    }
                    break;
                }
            }
        }
예제 #3
0
 private void OnClickButton(GameChoice choice)
 {
     Debug.Log("Choice Picked " + choice.Name);
     InkStoryManager.MakeChoice(choice.Index);
     StoryTextUI.text = "";
     CheckState();
 }
예제 #4
0
        private string GetGameName(GameChoice choice)
        {
            switch (choice)
            {
            case GameChoice.Rock:
                return("Камень");

                break;

            case GameChoice.Paper:
                return("Бумага");

                break;

            case GameChoice.Scissors:
                return("Ножницы");

                break;

            default:
                return("");

                break;
            }
        }
 public void TrainingChoices()
 {
     #region Training Selection for Player One
     if (Input.GetKeyDown(KeyCode.Alpha1) && !trainingOneSelected)
     {
         trainingOneSelected          = true;
         CameraOne.transform.position = trainingMode[0].trainingMode[0].transform.position;
         gameChoiceOne = GameChoice.PullUp;
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2) && !trainingOneSelected)
     {
         trainingOneSelected          = true;
         CameraOne.transform.position = trainingMode[0].trainingMode[1].transform.position;
         gameChoiceOne = GameChoice.Treadmill;
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3) && !trainingOneSelected)
     {
         trainingOneSelected          = true;
         CameraOne.transform.position = trainingMode[0].trainingMode[2].transform.position;
         gameChoiceOne = GameChoice.PunchingBag;
     }
     else if (Input.GetKeyDown(KeyCode.Alpha4) && !trainingOneSelected)
     {
         trainingOneSelected          = true;
         CameraOne.transform.position = trainingMode[0].trainingMode[3].transform.position;
         gameChoiceOne = GameChoice.Rest;
     }
     #endregion
     #region Training Selection for Player Two
     if (Input.GetKeyDown(KeyCode.Keypad1) && !trainingTwoSelected)
     {
         trainingTwoSelected          = true;
         CameraTwo.transform.position = trainingMode[1].trainingMode[0].transform.position;
         gameChoiceTwo = GameChoice.PullUp;
     }
     else if (Input.GetKeyDown(KeyCode.Keypad2) && !trainingTwoSelected)
     {
         trainingTwoSelected          = true;
         CameraTwo.transform.position = trainingMode[1].trainingMode[1].transform.position;
         gameChoiceTwo = GameChoice.Treadmill;
     }
     else if (Input.GetKeyDown(KeyCode.Keypad3) && !trainingTwoSelected)
     {
         trainingTwoSelected          = true;
         CameraTwo.transform.position = trainingMode[1].trainingMode[2].transform.position;
         gameChoiceTwo = GameChoice.PunchingBag;
     }
     else if (Input.GetKeyDown(KeyCode.Keypad4) && !trainingTwoSelected)
     {
         trainingTwoSelected          = true;
         CameraTwo.transform.position = trainingMode[1].trainingMode[3].transform.position;
         gameChoiceTwo = GameChoice.Rest;
     }
     #endregion
 }
예제 #6
0
        public void Music_From_off_to_onn_test()
        {
            GameChoice Test = new GameChoice(new System.Windows.Forms.Form());

            GameBox.Program.music_OnOff = false;

            Test.CB_music_click(new System.Object(), EventArgs.Empty);

            Assert.AreEqual(Program.music_OnOff, true);
            Assert.AreNotEqual(Program.music_OnOff, false);
        }
예제 #7
0
        private string GetChoice(GameChoice game)
        {
            if (User.GameChoices == null)
            {
                return(null);
            }
            uint   val = TakeBit(User.GameChoices, game.position, game.length);
            string c   = null;

            game.choice.TryGetValue(val, out c);
            return(c);
        }
예제 #8
0
        /// <summary>
        /// Plays player choice and random AI choice to determine winner, updating scores accordingly
        /// </summary>
        /// <param name="choice"></param>
        /// <returns></returns>
        public string PlayChoice(string choice)
        {
            // Parse string into GameChoice enum for player
            Enum.TryParse <GameChoice>(choice, out GameChoice playerChoice);

            // Get random choice for AI
            GameChoice AIChoice = (GameChoice)GetAIChoice();

            // Play game
            GetResult(playerChoice, AIChoice);
            UpdateScores();

            return(AIChoice.ToString());
        }
예제 #9
0
        private bool SetChoice(string choice, GameChoice game)
        {
            if (!game.choice.ContainsValue(choice))
            {
                return(false);
            }
            var      pair = game.choice.Single(c => c.Value == choice);
            BitArray ba   = new BitArray(User.GameChoices ?? new byte[1]);

            SetBit(ba, game.position, game.length, pair.Key);
            var newGameChoices = new byte[(ba.Length + 7) / 8];

            ba.CopyTo(newGameChoices, 0);
            User.GameChoices = newGameChoices;
            return(true);
        }
예제 #10
0
        private string GetUserChoiceStringFromEnum(GameChoice userChoice)
        {
            switch (userChoice)
            {
            case GameChoice.Paper:
                return("PAPER");

            case GameChoice.Rock:
                return("ROCK");

            case GameChoice.Scissors:
                return("SCISSORS");
            }

            return("ROCK");
        }
예제 #11
0
        private void SetUserImageSource(GameChoice gameChoice)
        {
            switch (gameChoice)
            {
            case GameChoice.Rock:
                UserChoiceImage.Source = ImageSource.FromFile("rock.png");
                break;

            case GameChoice.Paper:
                UserChoiceImage.Source = ImageSource.FromFile("paper.png");
                break;

            case GameChoice.Scissors:
                UserChoiceImage.Source = ImageSource.FromFile("scissors.png");
                break;
            }
        }
예제 #12
0
        private void SetOpponentImageSource(GameChoice gameChoice)
        {
            switch (gameChoice)
            {
            case GameChoice.Rock:
                ComputerChoiceImage.Source = ImageSource.FromFile("rock_op.png");
                break;

            case GameChoice.Paper:
                ComputerChoiceImage.Source = ImageSource.FromFile("paper_op.png");
                break;

            case GameChoice.Scissors:
                ComputerChoiceImage.Source = ImageSource.FromFile("scissors_op.png");
                break;
            }
        }
예제 #13
0
    void OnMenuStates()
    {
        LocationPanel.SetActive(true);
        //Need to show the correct image and Location Panel
        while (InkStoryManager.CanContineStory())
        {
            string text = InkStoryManager.GetStoryContent();
            StoryTextUI.text = text;

            List <Choice> choices = InkStoryManager.GetChoices();
            if (choices.Count > 0)
            {
                foreach (Button b in ChoiceButtons)
                {
                    b.gameObject.SetActive(false);
                }
                for (int i = 0; i < choices.Count; i++)
                {
                    GameChoice currentChoice = new GameChoice
                    {
                        Name  = choices[i].text,
                        Index = choices[i].index
                    };

                    Debug.Log(currentChoice);
                    if (i < ChoiceButtons.Length)
                    {
                        Button button = ChoiceButtons[i];
                        button.gameObject.SetActive(true);
                        button.onClick.RemoveAllListeners();
                        button.GetComponentInChildren <Text>().text = choices[i].text;
                        button.onClick.AddListener(() => OnClickButton(currentChoice));
                    }
                }
                GameChoice exitChoice = new GameChoice
                {
                    Name  = choices[choices.Count - 1].text,
                    Index = choices[choices.Count - 1].index
                };
                ExitButton.gameObject.SetActive(true);
                ExitButton.onClick.RemoveAllListeners();
                ExitButton.onClick.AddListener(() => OnClickButton(exitChoice));
            }
        }
    }
    public void SetChoice(GameChoice gameChoice)
    {
        switch (gameChoice)
        {
        case GameChoice.ROCK:
            playerChoice_img.sprite = rock_sprite;
            player_choice           = GameChoice.ROCK;
            break;

        case GameChoice.PAPER:
            playerChoice_img.sprite = paper_sprite;
            player_choice           = GameChoice.PAPER;
            break;

        case GameChoice.SCISSORS:
            playerChoice_img.sprite = scissors_sprite;
            player_choice           = GameChoice.SCISSORS;
            break;
        }
        SetOpponentChoice();
        DetermineWinner();
    }
    public void TrainingResult(GameChoice gameChoice, float amount)
    {
        switch (gameChoice)
        {
        case GameChoice.PullUp:
            maxHealth  += amount;
            maxStamina += amount;
            break;

        case GameChoice.Treadmill:
            speed += amount;
            break;

        case GameChoice.PunchingBag:
            damage += amount;
            break;

        case GameChoice.Rest:
            health  += 50;
            stamina += 50;
            break;
        }
    }
예제 #16
0
    public void GetChoice()
    {
        string choiceName = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name;

        GameChoice selectedChoice = GameChoice.NONE;

        switch (choiceName)
        {
        case "Rock":
            selectedChoice = GameChoice.ROCK;
            break;

        case "Paper":
            selectedChoice = GameChoice.PAPER;
            break;

        case "scissors":
            selectedChoice = GameChoice.SCISSORS;
            break;
        }

        playController.SetChoice(selectedChoice);
        animationController.PlayerMadeChoice();
    }
예제 #17
0
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            choiceBot           = (GameChoice)random.Next(0, 3);
            labelBotChoice.Text = GetGameName(choiceBot);


            choiceUser         = (GameChoice)random.Next(0, 3);
            labelMyChoice.Text = GetGameName(choiceUser);

            if (choiceBot == GameChoice.Paper)
            {
                switch (choiceUser)
                {
                case GameChoice.Rock:
                    MessageBox.Show("Вы проиграли!");
                    break;

                case GameChoice.Paper:
                    MessageBox.Show("Ничья!");
                    break;

                case GameChoice.Scissors:
                    MessageBox.Show("Вы выиграли!");
                    break;

                default:
                    break;
                }
            }
            if (choiceBot == GameChoice.Rock)
            {
                switch (choiceUser)
                {
                case GameChoice.Rock:
                    MessageBox.Show("Ничья!");
                    break;

                case GameChoice.Paper:
                    MessageBox.Show("Вы выиграли!");
                    break;

                case GameChoice.Scissors:
                    MessageBox.Show("Вы проиграли!");
                    break;

                default:
                    break;
                }
            }
            if (choiceBot == GameChoice.Scissors)
            {
                switch (choiceUser)
                {
                case GameChoice.Rock:
                    MessageBox.Show("Вы выиграли!");
                    break;

                case GameChoice.Paper:
                    MessageBox.Show("Вы проиграли!");
                    break;

                case GameChoice.Scissors:
                    MessageBox.Show("Ничья!");
                    break;

                default:
                    break;
                }
            }
        }
예제 #18
0
        private async Task HandleUserChoice(GameChoice userChoice)
        {
            var computerChoice = GetRandomInt(0, 2);

            switch (userChoice)
            {
            case GameChoice.Rock:
                if (computerChoice == (int)GameChoice.Rock)
                {
                    await HandleUserChoice(GameChoice.Rock);
                }
                else if (computerChoice == (int)GameChoice.Paper)
                {
                    ShowResultsToUser(false);
                    ComputerChoiceLabel.Text = "PAPER";
                    SetOpponentImageSource(GameChoice.Paper);
                }
                else
                {
                    ShowResultsToUser(true);
                    ComputerChoiceLabel.Text = "SCISSORS";
                    SetOpponentImageSource(GameChoice.Scissors);
                }
                break;

            case GameChoice.Paper:
                if (computerChoice == (int)GameChoice.Paper)
                {
                    await HandleUserChoice(GameChoice.Paper);
                }
                else if (computerChoice == (int)GameChoice.Rock)
                {
                    ShowResultsToUser(true);
                    ComputerChoiceLabel.Text = "ROCK";
                    SetOpponentImageSource(GameChoice.Rock);
                }
                else
                {
                    ShowResultsToUser(false);
                    ComputerChoiceLabel.Text = "SCISSORS";
                    SetOpponentImageSource(GameChoice.Scissors);
                }

                break;

            case GameChoice.Scissors:
                if (computerChoice == (int)GameChoice.Scissors)
                {
                    await HandleUserChoice(GameChoice.Scissors);
                }
                else if (computerChoice == (int)GameChoice.Paper)
                {
                    ShowResultsToUser(true);
                    ComputerChoiceLabel.Text = "PAPER";
                    SetOpponentImageSource(GameChoice.Paper);
                }
                else
                {
                    ShowResultsToUser(false);
                    ComputerChoiceLabel.Text = "ROCK";
                    SetOpponentImageSource(GameChoice.Rock);
                }
                break;
            }

            UserChoiceLabel.Text = GetUserChoiceStringFromEnum(userChoice);
            SetUserImageSource(userChoice);
        }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            PlayerOne.Instance.TrainingResult(GameChoice.Treadmill, 10);
        }
        if (trainingOneSelected)
        {
            playerOnePanel.alpha = Mathf.Lerp(playerOnePanel.alpha, 0, 10 * Time.deltaTime);
        }
        if (trainingTwoSelected)
        {
            playerTwoPanel.alpha = Mathf.Lerp(playerTwoPanel.alpha, 0, 10 * Time.deltaTime);
        }
        if (isRoundStart)
        {
            GameObject.FindGameObjectWithTag("Player One").GetComponent <PlayerController>().enabled = true;
            GameObject.FindGameObjectWithTag("Player Two").GetComponent <PlayerController>().enabled = true;
            if (preRoundTime > 0)
            {
                preRoundTime      -= Time.deltaTime;
                camView.isTraining = false;
                camView.inFight    = false;
                preRound           = true;
            }
            else
            {
                if (gameTime > 0)
                {
                    preRound        = false;
                    gameTime       -= Time.deltaTime;
                    camView.inFight = true;
                }
                else
                {
                    isBreakStart = true;
                    isRoundStart = false;
                    ChangeRounds();
                }
            }
        }
        else
        {
            GameObject.FindGameObjectWithTag("Player One").GetComponent <PlayerController>().enabled = false;
            GameObject.FindGameObjectWithTag("Player Two").GetComponent <PlayerController>().enabled = false;
        }
        if (isBreakStart)
        {
            isRoundStart    = false;
            isTrainingStart = false;
            animHUD.SetBool("OpenBreakUI", true);
            camView.isTraining = true;
            camView.inFight    = false;

            breakUI.alpha = Mathf.Lerp(breakUI.alpha, 1, 2 * Time.deltaTime);

            if (breakTime > 0)
            {
                breakTime -= Time.deltaTime;
                TrainingChoices();
            }
            else
            {
                if (trainingOneSelected == false)
                {
                    trainingOneSelected          = true;
                    CameraOne.transform.position = trainingMode[0].trainingMode[3].transform.position;
                    gameChoiceOne = GameChoice.Rest;
                }
                if (trainingTwoSelected == false)
                {
                    trainingTwoSelected          = true;
                    CameraOne.transform.position = trainingMode[1].trainingMode[3].transform.position;
                    gameChoiceTwo = GameChoice.Rest;
                }
                animTraining.SetBool("StartTraining", true);
                StartTraining();
                ChangeRounds();
            }
            if (trainingOneSelected && trainingTwoSelected)
            {
                animTraining.SetBool("StartTraining", true);
                StartTraining();
                ChangeRounds();
            }
        }
        if (isTrainingStart)
        {
            animHUD.SetBool("OpenBreakUI", false);
            if (trainTime > 0)
            {
                trainTime -= Time.deltaTime;
            }
            else
            {
                isRoundStart    = true;
                isTrainingStart = false;
                animTraining.SetBool("StartTraining", false);
                ChangeRounds();
            }
        }

        breakTimeText.text = breakTime.ToString("F0");
        gameTimeText.text  = gameTime.ToString("F0");
        trainTimeText.text = trainTime.ToString("F0");
    }
예제 #20
0
        // main steps for playing the game
        // given a player's choice, make the choice for the computer
        private void MakeGameChoices(GameChoice player)
        {
            playerOption = player;
            yourChoiceImage.ImageUrl = GameChoiceToAssetURL(playerOption);

            computerOption = ChooseComputerResponse();
            computerChoiceImage.ImageUrl = GameChoiceToAssetURL(computerOption);
        }
    void TrainingSelection(PlayerType player, GameChoice gameChoice)
    {
        switch (player)
        {
        case PlayerType.PlayerOne:
            switch (gameChoice)
            {
            case GameChoice.PullUp:
                #region Player 1 Pull-Up Mini-Game
                if (playerOneChosen == false)
                {
                    pullStart1 = true;
                    player1PullupAnim.SetBool("PullupTraining", true);

                    playerOneChosen = true;
                }

                if (pullStart1 == true)
                {
                    if (pullReset1 == false)
                    {
                        if (Input.GetKey(o_Action) && pullRelease1 == false)
                        {
                            pullBar1 += pull1 * Time.deltaTime;

                            player1PullupAnim.SetBool("isGoingDown", false);
                            player1PullupAnim.SetBool("isPullingUp", true);
                        }

                        else
                        {
                            pullBar1 -= (pull1 * 3) * Time.deltaTime;
                        }

                        if (pullBar1 <= 0f)
                        {
                            pullBar1 = 0f;
                        }

                        if (pullBar1 >= 100f)
                        {
                            if (pullCounted1 == false)
                            {
                                pullCount1 += 1;

                                pullCounted1 = true;
                            }

                            pullBar1 = 100f;
                        }

                        if (Input.GetKeyUp(o_Action))
                        {
                            pullRelease1 = true;

                            player1PullupAnim.SetBool("isPullingUp", false);
                            player1PullupAnim.SetBool("isGoingDown", true);

                            if (pullCounted1 == true)
                            {
                                pullCounted1 = false;
                            }

                            pullReset1 = true;
                        }
                    }

                    if (pullReset1 == true)
                    {
                        pullBar1 -= (pull1 * 6) * Time.deltaTime;

                        if (pullBar1 <= 0f)
                        {
                            pullRelease1 = false;

                            pullReset1 = false;
                        }
                    }

                    if (pullCount1 >= 3)
                    {
                        player1Won = true;

                        pullStart1 = false;

                        Debug.Log("Player 1 Won PULL-UPS!");
                    }
                    if (player1Won == true)
                    {
                        PlayerOne.Instance.TrainingResult(GameChoice.PullUp, 5);
                        player1Won = false;
                    }
                }

                if (pullStart1 == false)
                {
                    if (pullCount1 < 3)
                    {
                        Debug.Log("Player 1 Lost PULL-UPS!");

                        player1Lost = true;
                    }
                }
                #endregion
                break;

            case GameChoice.Treadmill:
                #region Player 1 Treadmill Mini-Game
                if (playerOneChosen == false)
                {
                    treadStart1     = true;
                    playerOneChosen = true;
                }

                if (treadStart1 == true)
                {
                    treadWinScore1 -= runDown1 * Time.deltaTime;

                    if (treadWinScore1 <= 0f)
                    {
                        treadWinScore1 = 0f;
                    }
                    if (treadWinScore1 >= 110f)
                    {
                        treadWinScore1 = 110f;
                    }
                }

                if (Input.GetKeyDown(o_Action) && treadStart1 == true)
                {
                    treadWinScore1 = treadWinScore1 + treadRunUp1;
                }

                if (treadStart1 == false && treadWinScore1 >= 100f)
                {
                    player1Won = true;
                    Debug.Log("Player 1 Won TREADMILL!");
                    treadWinScore1 = 0f;
                }
                if (player1Won == true && trainEnded)
                {
                    PlayerOne.Instance.TrainingResult(GameChoice.Treadmill, 5);
                    player1Won = false;
                }

                if (treadStart1 == false && treadWinScore1 < 100f)
                {
                    player1Lost = true;

                    Debug.Log("Player 1 Lost TREADMILL!");
                }
                #endregion
                break;

            case GameChoice.PunchingBag:
                #region Player 1 Heavy-Bag Mini-Game
                if (playerOneChosen == false)
                {
                    bagStart1 = true;
                    //player1PunchbagAnim.SetBool("PullupTraining", true);
                    playerOneChosen = true;
                }

                if (bagStart1 == true)
                {
                    bagMove1 = punchingBagOne.transform.localPosition.magnitude;

                    if (Input.GetKeyDown(o_Action))
                    {
                        //player1PunchbagAnim.SetBool("isGoingDown", false);
                        //player1PunchbagAnim.SetBool("isPullingUp", true);

                        bagStart1 = false;
                    }
                }

                if (bagStart1 == false)
                {
                    if (countPunchOne >= 3 && trainingTimer <= 0)
                    {
                        PlayerOne.Instance.TrainingResult(GameChoice.PunchingBag, 5);
                        countPunchOne = 0;
                        bagStart1     = true;
                        return;
                    }
                    if (bagMove1 >= 0 && bagMove1 <= 20)
                    {
                        Debug.Log("Player Wins PUNCHING BAG!");
                        countPunchOne++;
                        bagStart1 = true;

                        player1Won = true;
                    }

                    if (bagMove1 < 0 || bagMove1 > 20)
                    {
                        Debug.Log("Player Loses PUNCHING BAG!");
                        bagStart1   = true;
                        player1Lost = true;
                    }
                }
                #endregion
                break;

            case GameChoice.Rest:
                break;
            }
            break;

        case PlayerType.PlayerTwo:
            switch (gameChoice)
            {
            case GameChoice.PullUp:
                #region Player 2 Pull-Up Mini-Game
                if (playerTwoChosen == false)
                {
                    pullStart2      = true;
                    playerTwoChosen = true;
                }

                if (pullStart2 == true)
                {
                    if (pullReset2 == false)
                    {
                        if (Input.GetKey(t_Action) && pullRelease2 == false)
                        {
                            pullBar2 += pull2 * Time.deltaTime;
                        }

                        else
                        {
                            pullBar2 -= (pull2 * 3) * Time.deltaTime;
                        }

                        if (pullBar2 <= 0f)
                        {
                            pullBar2 = 0f;
                        }

                        if (pullBar2 >= 100f)
                        {
                            if (pullCounted2 == false)
                            {
                                pullCount2 += 1;

                                pullCounted2 = true;
                            }

                            pullBar2 = 100f;
                        }

                        if (Input.GetKeyUp(t_Action))
                        {
                            pullRelease2 = true;

                            if (pullCounted2 == true)
                            {
                                pullCounted2 = false;
                            }

                            pullReset2 = true;
                        }
                    }

                    if (pullReset2 == true)
                    {
                        pullBar2 -= (pull2 * 6) * Time.deltaTime;

                        if (pullBar2 <= 0f)
                        {
                            pullRelease2 = false;

                            pullReset2 = false;
                        }
                    }

                    if (pullCount2 == 3)
                    {
                        player2Won = true;

                        pullStart2 = false;

                        Debug.Log("Player 2 Won PULL-UPS!");
                    }
                    if (player2Won == true)
                    {
                        PlayerTwo.Instance.TrainingResult(GameChoice.PullUp, 5);
                        player2Won = false;
                    }
                }

                if (pullStart2 == false)
                {
                    if (pullCount2 < 3)
                    {
                        Debug.Log("Player 2 Lost PULL-UPS!");

                        player2Lost = true;
                    }
                }
                #endregion
                break;

            case GameChoice.Treadmill:
                #region Player 2 Treadmill Mini-Game
                if (playerTwoChosen == false)
                {
                    treadStart2     = true;
                    playerTwoChosen = true;
                }

                if (treadStart2 == true)
                {
                    //trainingTimer -= Time.deltaTime;

                    treadWinScore2 -= runDown1 * Time.deltaTime;

                    if (treadWinScore2 <= 0f)
                    {
                        treadWinScore2 = 0f;
                    }
                    if (treadWinScore2 >= 110f)
                    {
                        treadWinScore2 = 110f;
                    }

                    if (trainingTimer <= 0)
                    {
                        trainingTimer = 0f;

                        treadStart2 = false;
                    }
                }

                if (Input.GetKeyDown(t_Action) && treadStart2 == true)
                {
                    treadWinScore2 = treadWinScore2 + treadRunUp1;
                }

                if (treadStart2 == false && treadWinScore2 >= 100f)
                {
                    player2Won     = true;
                    treadWinScore2 = 0f;
                    Debug.Log("Player 2 Won TREADMILL!");
                }

                if (player2Won == true && trainEnded)
                {
                    PlayerTwo.Instance.TrainingResult(GameChoice.Treadmill, 5);
                    player2Won = false;
                }

                if (treadStart2 == false && treadWinScore2 < 100f)
                {
                    player2Lost = true;

                    Debug.Log("Player 2 Lost TREADMILL!");
                }
                #endregion
                break;

            case GameChoice.PunchingBag:
                #region Player 2 Heavy-Bag Mini-Game
                if (playerTwoChosen == false)
                {
                    bagStart2       = true;
                    playerTwoChosen = true;
                }

                if (bagStart2 == true)
                {
                    bagMove2 = punchingBagTwo.transform.localPosition.magnitude;

                    if (Input.GetKeyDown(t_Action))
                    {
                        bagStart2 = false;
                    }
                }

                if (bagStart2 == false)
                {
                    if (countPunchTwo >= 3 && trainingTimer <= 0)
                    {
                        PlayerTwo.Instance.TrainingResult(GameChoice.PunchingBag, 5);
                        countPunchTwo = 0;
                        bagStart2     = true;
                        return;
                    }
                    if (bagMove2 >= 0 && bagMove2 <= 20)
                    {
                        countPunchTwo++;
                        //bagStart2 = true;
                        Debug.Log("Player Wins PUNCHING BAG!");

                        player2Won = true;
                    }

                    if (bagMove2 < 0 || bagMove2 > 20)
                    {
                        //bagStart2 = true;
                        Debug.Log("Player Loses PUNCHING BAG!");

                        player2Lost = true;
                    }
                }
                #endregion
                break;

            case GameChoice.Rest:
                break;
            }
            break;
        }
    }
예제 #22
0
 public void EndArcade()
 {
     levelStarted = false;
     gameChoice   = GameChoice.New;
     gameLevel    = 1;
 }
예제 #23
0
        // mapping GameChoice's to actual images in the assets folder
        private string GameChoiceToAssetURL(GameChoice gc)
        {
            string PREFIX = "Assets/";

            if (gc == GameChoice.rock)
            {
                return PREFIX + "rock.png";
            }
            else if (gc == GameChoice.paper)
            {
                return PREFIX + "paper.png";
            }
            else
            {
                return PREFIX + "scissors.png";
            }
        }
예제 #24
0
 public void LostLevel()
 {
     levelStarted = false;
     gameChoice   = GameChoice.Retry;
     gameLevel    = 1;
 }