// Increase the bounce count public void increaseBounceCount() { // If the colour switch count is less than 2 if (colourSwitchCount < 2) { // Add 2 to the player's score setBounceCount(getBounceCount() + 2); // Spawn the alert text hudLayerController.getGameplayHUDLayer().printAlertText("Switch Bonus"); } // Otherwise else { // Add 1 to the player's score setBounceCount(getBounceCount() + 1); } colourSwitchCount = 0; hudLayerController.getGameplayHUDLayer().updateHUDElements(); // If the bounce count is equal to the target if (bounceCount >= ScoreTargetController.getScoreTarget()) { // End the game ScoreTargetController.setCanGenerateScoreTarget(true); PlayerStatsContainer.setWins(PlayerStatsContainer.getWins() + 1); StartCoroutine(GameStateController.endGame()); } }
// Start the game public static IEnumerator startGame() { hudLayerController.showStartingHUDLayer(); yield return(new WaitForSeconds(3.0f)); hudLayerController.hideStartingHUDLayer(); hudLayerController.showGameplayHUDLayer(); ScoreTargetController.generateScoreTarget(); player.enable(); hudLayerController.getGameplayHUDLayer().updateHUDElements(); }