// Start is called before the first frame update void Start() { loadingScreen = GameObject.FindGameObjectWithTag("LoadingScreen").GetComponent <GRHLoadingScreen>(); LoadSettings(); soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <GRHCountingMG_SoundManager>(); // Sets the amount of spawnables that the player must guess entityAmount = (int)UnityEngine.Random.Range((amountOfEntitiesToSpawn / 2) / 1.75f, (amountOfEntitiesToSpawn / 2) * 1.75f); fakeEntityAmount = amountOfEntitiesToSpawn - entityAmount; //Set the Time Left text to display how much time will be on the clock. timeLeftText.text = $"Time Left: {gameDuration}"; //Pass the amount of real entities to the AI's for (int i = 0; i < AIObjects.Length; i++) { AIObjects[i].GetComponent <GRHCountingMG_AIController>().totalCount = entityAmount; } //Set the guess modifier buttons to non-interactable addButton.interactable = false; subtractButton.interactable = false; // If the game is not being replayed (music is not already playing), then start the background music if (!soundManager.IsCountingGameMusicPlaying()) { soundManager.CountingGameMusic(); soundManager.countingMG_Audio[0].volume = 0.25f; } }
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(); }