void InitRockPaperScissorsNuke() { p1Choice = choice.NONE; p2Choice = choice.NONE; // init the graphics p1ChoiceGUI.enabled = false; p2ChoiceGUI.enabled = false; p1Score.SetText(GameState.Instance.ScorePlayer1.ToString() + " POINTS"); p2Score.SetText(GameState.Instance.ScorePlayer2.ToString() + " POINTS"); state = RPSNGameState.ANIMATIONS_WAIT; }
// wait for the players to choose their move, display results from battle IEnumerator WaitForChoices() { state = RPSNGameState.CHOOSE_WEAPON; // wait for players to choose their move float choiceCounter = RPSNChoiceWaitTime; while (!BothPlayersReady() && choiceCounter > 1) { choiceCounter -= 0.01f; // update the counter RPSNcountdownTimer.SetText(Mathf.FloorToInt(choiceCounter).ToString()); ChoiceListen(); yield return(new WaitForSeconds(0.01f)); } // purchase the choices PurchaseChoice(1); PurchaseChoice(2); battleOutcome result = Battle(); // display the results of their choices DisplayBattleOutcome(result); float displayOutcomeCounter = winnerChoiceDisplayTime; while (displayOutcomeCounter > 1) { displayOutcomeCounter -= 0.1f; yield return(new WaitForSeconds(0.1f)); } // have the player who won the battle select the next stage StartCoroutine(ChooseMinigame()); // SIMULATE PLAYING A GAME /* * if (result == battleOutcome.P1WIN) * { * SimulatePlayerWinningMinigame(1); * } * else if (result == battleOutcome.P2WIN) * { * SimulatePlayerWinningMinigame(2); * } * else * { * SimulatePlayerWinningMinigame(Random.Range(1, 2)); * } */ }