private void Awake() { gameSettings = FindObjectOfType <GRHGameSettings>(); soundManager = FindObjectOfType <GRHBalloonMG_SoundManager>(); loadingScreen = GameObject.FindGameObjectWithTag("LoadingScreen").GetComponent <GRHLoadingScreen>(); difficultySettingPanelBalloonGame.SetActive(false); difficultySettingPanelCountingGame.SetActive(false); creditsPanel.SetActive(false); easyButton.enabled = false; mediumButton.enabled = false; hardButton.enabled = false; creditsToggle = false; }
//Game scene initialization. void Start() { //Get the main camera / animation controller. mainCamera = Camera.main; animationController = FindObjectOfType <GRHBalloonMG_AnimationController>(); isPlaying = false; //Set the sound manager. soundManager = FindObjectOfType <GRHBalloonMG_SoundManager>(); //Set the AI Controller. [Added by Bryce] aiController = GetComponent <GRHBalloonMG_AIController>(); //Gets the loading screen object script loadingScreen = GameObject.FindGameObjectWithTag("LoadingScreen").GetComponent <GRHLoadingScreen>(); //Object initialization is called here to prevent object racing. We check for objects that aren't necessarily required, such as the camera controller. if (mainCamera.GetComponent <GRHCameraController>()) { mainCamera.GetComponent <GRHCameraController>().Initialize(); } // [Added by Adam] pauseGamePanel.SetActive(false); soundManager.balloonMG_Audio[1].volume = 0.1f; Time.timeScale = 1; isPaused = false; //Sets current player character selection selectedCharacter = GRHGameSettings.gameSettings.selectedCharacter; //Sets the Player's selected character & position animationController.SetCharacterAnimationPosition(GRHBalloonMG_AnimationController.AnimationObject.Player, charactersInScene[selectedCharacter].GetComponent <Animator>(), charactersInScene[selectedCharacter]); SetLabel(playerLabel[selectedCharacter], playerLabelImage, "P1", Color.red); // Set the rest of the AI's active states and positions SetAIActiveState(); //Initializes Settings in the Animation Controller. animationController.Initialize(); //Set all players to active. for (int i = 0; i < 4; i++) { activePlayers[i] = true; } //Get the max balloon pumps from the difficulty settings script. maxBalloonPumps = FindObjectOfType <GRHGameSettings>().pumpCount; currentBalloonPumps = 0; endMessage = ""; //Update balloon pumps text. balloonPumpsLeftText.text = $"{maxBalloonPumps}"; if (!FindObjectOfType <GRHGameSettings>().showPumpCount) { balloonPumpsLeftText.enabled = false; } //Start the music for the game. if (!soundManager.balloonMG_Audio[1].isPlaying) { soundManager.BalloonMGGameMusic(); } //After initialization, set the game state to the introduction, and start the main camera movements, if we have a main camera controller. currentGameState = BalloonPopGameStates.Introduction; //Hide the player UI. HidePlayerUI(); }