void Awake() { this.lvl2PlatformCollider.isTrigger = true; highscore = GameObject.FindWithTag("HighScoreController"); //create reference for Player gameobject, and assign the variable via FindWithTag at start if (highscore != null) // if the playerObject gameObject-reference is not null - assigning the reference via FindWithTag at first frame - { highscoreScript = highscore.GetComponent<HighScoreController>();// - set the PlayerController-reference (called playerControllerScript) to the <script component> of the Player gameobject (via the gameObject-reference) to have access the instance of the PlayerController script } if (highscore == null) //for exception handling - to have the console debug the absense of a player controller script in order for this entire code, the code in the GameController to work { Debug.Log("Cannot find ScoreController script for final score referencing to GameOver - finalAcquired Label"); } if(highscoreScript.loadLevelIndex == 3) { this.lvl2PlatformCollider.isTrigger = false; background.GetComponent<Renderer>().material = newMatLevel2; platform.GetComponent<SpriteRenderer>().sprite = level2Platform; platform.GetComponent<Transform>().transform.localScale = new Vector3(1.5f, 1.5f,1); platform.GetComponent<Transform>().transform.position = new Vector3(-399, -251, 0); } else if (highscoreScript.loadLevelIndex == 4) { this.lvl2PlatformCollider.isTrigger = false; background.GetComponent<Renderer>().material = newMatLevel3; platform.GetComponent<SpriteRenderer>().sprite = level3Platform; //platform.GetComponent<Transform>().transform.localScale = new Vector3(1.5f, 1.5f, 1); platform.GetComponent<Transform>().transform.position = new Vector3(-399, -240, 0); } this.finalScoreLabel.text = "Final Score: " + highscoreScript.keepScore; }
//runs first void Awake() { if(!created){ DontDestroyOnLoad(gameObject); created=true; instance=this; } else{ Destroy(gameObject); } }
// Use this for initialization void Start() { this._audioSources = this.GetComponents<AudioSource> (); this._cloudAudioSource = this._audioSources [1]; this._islandAudioSource = this._audioSources [2]; this._endAudioSource = this._audioSources [3]; this._livesAudioSource = this._audioSources [4]; this._highScoreController = GameObject.FindWithTag ("HighScoreController").GetComponent ("HighScoreController") as HighScoreController; this._SetScore (); }
// Use this for initialization void Awake() { highscore = GameObject.FindWithTag("HighScoreController"); //create reference for Player gameobject, and assign the variable via FindWithTag at start if (highscore != null) // if the playerObject gameObject-reference is not null - assigning the reference via FindWithTag at first frame - { highscoreScript = highscore.GetComponent<HighScoreController>();// - set the PlayerController-reference (called playerControllerScript) to the <script component> of the Player gameobject (via the gameObject-reference) to have access the instance of the PlayerController script } if (highscore == null) //for exception handling - to have the console debug the absense of a player controller script in order for this entire code, the code in the GameController to work { Debug.Log("Cannot find ScoreController script for final score referencing to GameOver - finalAcquired Label"); } }
///<summary> ///HandleUserInput handles the user SwinGame. /// </summary> /// <remarks> /// Reads the key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { // Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: { MenuController.HandleMainMenuInput(); break; } case GameState.ViewingGameMenu: { MenuController.HandleGameMenuInput(); break; } case GameState.AlteringSettings: { MenuController.HandleDifficultyMenuInput(); break; } case GameState.Deploying: { DeploymentController.HandleDeploymentInput(); break; } case GameState.Discovering: { DiscoveryController.HandleDiscoveryInput(); break; } case GameState.EndingGame: { EndingGameController.HandleEndOfGameInput(); break; } case GameState.ViewingHighScores: { HighScoreController.HandleHighScoreInput(); break; } } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); SwinGame.StopTimer(Timer); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); SwinGame.StopTimer(Timer); break; case GameState.AlteringSettings: MenuController.DrawSettings(); SwinGame.StopTimer(Timer); break; case GameState.Deploying: DeploymentController.DrawDeployment(); SwinGame.ResetTimer(Timer); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); if (SwinGame.TimerTicks(Timer) == 0) { SwinGame.StartTimer(Timer); } break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); SwinGame.StopTimer(Timer); break; case GameState.ViewInstruction: Instruction.WriteInstruction(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); if (SwinGame.KeyTyped(KeyCode.vk_f)) { SwinGame.ToggleFullScreen(); } switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSetup: MenuController.HandleSetupMenuInput(); break; case GameState.AlteringSetting: MenuController.HandleSettingMenuInput(); break; case GameState.BGMSettings: MenuController.HandleBGMMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: case GameState.HowToPlay: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
private void AddElemnts() { for (int i = 0; i < lenght; i++) { GameObject player = Instantiate(prefab, transform); int score = 0; string name = ""; player.SetActive(true); HighScoreController.GetElementsList(keyTable, i, out score, out name); player.GetComponent <TablePlayer>().SetValue(name, (i + 1).ToString(), score.ToString()); listObject.Add(player); } }
public void NameValidation() { GameObject go = new GameObject(); go.AddComponent <HighScoreController>(); HighScoreController sc = go.GetComponent <HighScoreController>(); Assert.IsTrue(sc.IsValidName("AAA")); Assert.IsFalse(sc.IsValidName("AA")); Assert.IsFalse(sc.IsValidName("123")); Assert.IsFalse(sc.IsValidName("aaa")); Assert.IsFalse(sc.IsValidName("!@#")); }
private void Awake() { m_HighScoreController = GameObject.FindGameObjectWithTag("HighScoreSystem").GetComponent <HighScoreController>(); m_ResponseText.text = "Not Logged In........."; if (m_HighScoreController.Player_Email != null) { m_ResponseText.text = "Logged in as " + m_HighScoreController.Player_Username; } else { m_ResponseText.text = "Not Logged In..."; } }
//runs first void Awake() { if (!created) { DontDestroyOnLoad(gameObject); created = true; instance = this; } else { Destroy(gameObject); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); HighScoreController scoreController = (HighScoreController)target; GUILayout.Label("Your score"); if (GUILayout.Button("Add 10 to curr score")) { if (HighScoreController.onAddToCurrentScore != null) { HighScoreController.onAddToCurrentScore(10); } } if (GUILayout.Button("Remove 10 from curr score")) { if (HighScoreController.onRemoveFromCurrentScore != null) { HighScoreController.onRemoveFromCurrentScore(10); } } if (GUILayout.Button("Reset curr Score")) { if (HighScoreController.onRemoveFromCurrentScore != null) { HighScoreController.onRemoveFromCurrentScore(99999999); } } GUILayout.Label("High score"); if (GUILayout.Button("Set High Score")) { var currScore = scoreController.GetCurrScore(); if (HighScoreController.onSetHighScore != null) { HighScoreController.onSetHighScore(currScore); } } if (GUILayout.Button("Reset High Score")) { if (HighScoreController.onSetHighScore != null) { HighScoreController.onSetHighScore(0); } } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; // Added Function: Change Music Function // Author: Ernest Soo case GameState.AlteringMusic: MenuController.DrawMusic(); break; // Added Function: Change Background Function // Author: Jacky Ten case GameState.AlteringBackground: MenuController.DrawBackground(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); if (CurrentState == GameState.ViewingMainMenu) { SwinGame.StopTimer(GameTimer); MenuController.DrawMainMenu(); } else if (CurrentState == GameState.ViewingGameMenu) { SwinGame.StopTimer(GameTimer); MenuController.DrawGameMenu(); } else if (CurrentState == GameState.AlteringSettings) { SwinGame.StopTimer(GameTimer); MenuController.DrawSettings(); } else if (CurrentState == GameState.AlterMusics) { SwinGame.StopTimer(GameTimer); MenuController.DrawMusicSettings(); } else if (CurrentState == GameState.Deploying) { SwinGame.ResetTimer(GameTimer); DeploymentController.DrawDeployment(); } else if (CurrentState == GameState.Discovering) { if (SwinGame.TimerTicks(GameTimer) == 0) { SwinGame.StartTimer(GameTimer); } DiscoveryController.DrawDiscovery(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.DrawEndOfGame(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.DrawHighScores(); } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(120); }
/// <summary> /// Read the user's name for their highsSwinGame. /// </summary> /// <param name="value">the player's sSwinGame.</param> /// <remarks> /// This verifies if the score is a highsSwinGame. /// </remarks> public static void ReadHighScore(int value) { const int ENTRY_TOP = 500; if (_Scores.Count == 0) { LoadScores(GameController.filename); } //is it a high score if ((value > _Scores[_Scores.Count - 1].Value)) { Score s = new Score(); s.Value = value; GameController.AddNewState(GameState.AddingHighScores); int x = 0; x = SCORES_LEFT + SwinGame.TextWidth(GameResources.GameFont("Courier"), "Name: "); SwinGame.StartReadingText(Color.White, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP); //Read the text from the user while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UtilityFunctions.DrawBackground(); HighScoreController.AddHighScore(); SwinGame.DrawText("Name: ", Color.White, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP); SwinGame.RefreshScreen(); } s.Name = SwinGame.TextReadAsASCII(); if (s.Name.Length < 3) { s.Name = s.Name + new string(Convert.ToChar(" "), 3 - s.Name.Length); } _Scores.RemoveAt(_Scores.Count - 1); _Scores.Add(s); _Scores.Sort(); SaveScores(GameController.filename); GameController.EndCurrentState(); } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.ChangingMusic: MenuController.DrawMusicMenu(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; case GameState.ShowingHint: // ShowingHint state draws the Hints on top of the regular grid DiscoveryController.DrawDiscovery(); DiscoveryController.DrawHint(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
// Use this for initialization void Start() { //Reset the difficulty on load DifficultyController.ResetVariables(); highScoreText.text = HighScoreController.GetHighScores(); flashPanel.SetActive(false); AdjustScore(0); //Initialize the score text to current; TakeDamage(0, Color.black); //Initialize the text to the current health //Begin the incrememnting of the difficulty //Every 20 seconds, increment difficulty InvokeRepeating("IncrementDifficulty", .2f, difficultyIncrementInterval); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; /*Added MusicSettings*/ case GameState.MusicSettings: MenuController.HandleMusicMenuInput(); break; /*Add themesetting*/ case GameState.ThemeColors: MenuController.HandleThemeMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.ChangingMusic: MenuController.HandleMusicMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; case GameState.ShowingHint: // ShowingHint state must use same input handler as Discovery state // since it works on top of the same state DiscoveryController.HandleDiscoveryInput(); break; } UtilityFunctions.UpdateAnimations(); }
void CheckHighScore() { print("CheckHighScore"); highScorePosition = HighScoreController.CheckForHighScore(totalScore); print(highScorePosition); if (highScorePosition < 10) { loseScreen.SetActive(false); highScorePanel.SetActive(true); StartCoroutine(WaitForName()); } else { SceneManager.LoadScene("_Scene_MainMenu"); } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.BGMSettings: MenuController.DrawBGM(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; case GameState.changeship: MenuController.DrawShipChange(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { if (SwinGame.KeyTyped(KeyCode.vk_m)) { GameResources.Mute(); } if (SwinGame.KeyTyped(KeyCode.vk_p)) { GameResources.Play(); } UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
// '' <summary> // '' Read the user's name for their highsSwinGame. // '' </summary> // '' <param name="value">the player's sSwinGame.</param> // '' <remarks> // '' This verifies if the score is a highsSwinGame. // '' </remarks> public static void ReadHighScore(int value) { const int ENTRY_TOP = 500; if (_scores.Count == 0) { LoadScores(); } // Is it a high score: if ((value > _scores[(_scores.Count - 1)].Value)) { Score s = new Score(); s.Value = value; GameController.AddNewState(GameState.ViewingHighScores); int x = (SCORES_LEFT + SwinGame.TextWidth(GameResources.GameFont("Courier"), "Name: ")); SwinGame.StartReadingText(Color.White, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP); // Read the text from the user while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UtilityFunctions.DrawBackground(); HighScoreController.DrawHighScores(); SwinGame.DrawText("Name: ", Color.White, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP); SwinGame.RefreshScreen(); } // Set the name length to 3 characters s.Name = SwinGame.TextReadAsASCII(); if ((s.Name.Length < NAME_WIDTH)) { s.Name = (s.Name + new string(' ', NAME_WIDTH - s.Name.Length)); } _scores.RemoveAt((_scores.Count - 1)); _scores.Add(s); _scores.Sort(); SaveScores(); GameController.EndCurrentState(); } }
/// <summary> /// Handle the input during the end of the game. Any interaction /// will result in it reading in the highsSwinGame. /// </summary> public static void HandleEndOfGameInput() { //string time = DateTime.Now.ToString("h:mm:ss "); var date = DateTime.Now.ToString("dd.MM.yyy"); var result = DialogResult.OK; if (SwinGame.MouseClicked(MouseButton.LeftButton) || SwinGame.KeyTyped(KeyCode.vk_RETURN) || SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { MessageBox.Show("Time : " + stopWatch.Elapsed.ToString("mm\\:ss\\.ff") + Environment.NewLine); if (result == DialogResult.OK) { HighScoreController.ReadHighScore(GameController.HumanPlayer.Score); GameController.EndCurrentState(); } } }
/// <summary> /// Draws the current state of the game to the screen. /// </summary> /// <remarks> /// What is drawn depends upon the state of the game. /// </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.DrawMainMenu(); break; case GameState.ViewingGameMenu: MenuController.DrawGameMenu(); break; case GameState.AlteringSettings: MenuController.DrawSettings(); break; case GameState.Deploying: DeploymentController.DrawDeployment(); MenuController.DrawCommonMenu(); // Aerisha Changes/Additions break; case GameState.Discovering: DiscoveryController.DrawDiscovery(); MenuController.DrawCommonMenu(); // Aerisha Changes/Additions break; case GameState.EndingGame: EndingGameController.DrawEndOfGame(); break; case GameState.ViewingHighScores: HighScoreController.DrawHighScores(); MenuController.DrawScoresPage(); // Aerisha Changes/Additions break; case GameState.ViewingInstructMenu: Instructions.DrawInstruct(); break; } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
// Complete new score collection // Returns the location of the current high score controller Caret. public Vector3 NewScoreDone() { highScoresData.NewScoreDone(); Vector3 pos = Vector3.zero; if (currentHighScoreController) { Vector2 vPos = RectTransformUtility.WorldToScreenPoint(null, currentHighScoreController.Caret.position); pos = new Vector3(vPos.x, vPos.y, 0); } currentHighScoreController = null; newHighScoreIndex = -1; return(pos); }
void Start() { op = GameObject.FindWithTag("OptionsController").GetComponent <OptionsController> (); if (SceneManager.GetActiveScene().buildIndex == 1) { gc = GameObject.FindWithTag("GameController").GetComponent <GameController> (); } CheckPanels(SceneManager.GetActiveScene().buildIndex); if (SceneManager.GetActiveScene().buildIndex == 2) { hs = GameObject.FindWithTag("ScoreController").GetComponent <HighScoreController> (); hs.checkForNewHighScore(); } }
// Use this for initialization void Awake() { highScoreInstance = GetComponent <HighScoreController> (); highScore = new List <int>(); AssignTextFields(10); //SetExemplaryScore (); //SaveScore (); highScore.Clear(); //PlayerPrefs.DeleteAll (); LoadHighScores(); SetTop(10); DontDestroyOnLoad(gameObject); //DebugScores (); Debug.Log("Start of HighScoreController"); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); if (_muteCheck) { SwinGame.PauseMusic(); } else { SwinGame.ResumeMusic(); } if (CurrentState == GameState.ViewingMainMenu) { MenuController.HandleMainMenuInput(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.HandleGameMenuInput(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.HandleSetupMenuInput(); } else if (CurrentState == GameState.Deploying) { DeploymentController.HandleDeploymentInput(); } else if (CurrentState == GameState.Discovering) { DiscoveryController.HandleDiscoveryInput(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.HandleEndOfGameInput(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.HandleHighScoreInput(); } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// ''' Draws the current state of the game to the screen. /// ''' </summary> /// ''' <remarks> /// ''' What is drawn depends upon the state of the game. /// ''' </remarks> public static void DrawScreen() { UtilityFunctions.DrawBackground(); if (CurrentState == GameState.ViewingMainMenu) { MenuController.DrawMainMenu(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.DrawGameMenu(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.DrawSettings(); } else if (CurrentState == GameState.ChangingMusic) //Recently Added { MenuController.DrawMusicMenu(); } else if (CurrentState == GameState.Deploying) { DeploymentController.DrawDeployment(); } else if (CurrentState == GameState.AlteringOption) { MenuController.DrawOption(); //RECENTLY ADDED } else if (CurrentState == GameState.Discovering) { DiscoveryController.DrawDiscovery(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.DrawEndOfGame(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.DrawHighScores(); } UtilityFunctions.DrawAnimations(); SwinGame.RefreshScreen(); }
//private AudioSource[] _audioSources; // private AudioSource _portalSound; //private Animator _animator; void Awake() { GameObject highscore = GameObject.FindWithTag("HighScoreController"); //create reference for Player gameobject, and assign the variable via FindWithTag at start if (highscore != null) // if the playerObject gameObject-reference is not null - assigning the reference via FindWithTag at first frame - { highscoreScript = highscore.GetComponent <HighScoreController>(); // - set the PlayerController-reference (called playerControllerScript) to the <script component> of the Player gameobject (via the gameObject-reference) to have access the instance of the PlayerController script } else if (highscore == null) //for exception handling - to have the console debug the absense of a player controller script in order for this entire code, the code in the GameController to work { Debug.Log("Cannot find ScoreController script for final score referencing to GameOver - finalAcquired Label"); } if (this.instructLabel2 != null) { this.instructLabel2.enabled = false; } }
/// <summary> /// ''' Handles the user SwinGame. /// ''' </summary> /// ''' <remarks> /// ''' Reads key and mouse input and converts these into /// ''' actions for the game to perform. The actions /// ''' performed depend upon the state of the game. /// ''' </remarks> public static void HandleUserInput() { // Read incoming input events SwinGame.ProcessEvents(); if (CurrentState == GameState.ViewingMainMenu) { MenuController.HandleMainMenuInput(); } else if (CurrentState == GameState.ViewingGameMenu) { MenuController.HandleGameMenuInput(); } else if (CurrentState == GameState.AlteringSettings) { MenuController.HandleSetupMenuInput(); } else if (CurrentState == GameState.ChangingMusic) //Recently Added { MenuController.HandleMusicMenuInput(); } else if (CurrentState == GameState.Deploying) { DeploymentController.HandleDeploymentInput(); } else if (CurrentState == GameState.Discovering) { DiscoveryController.HandleDiscoveryInput(); } else if (CurrentState == GameState.AlteringOption) //RECENTLY ADDED { MenuController.HandleOptionMenuInput(); } else if (CurrentState == GameState.EndingGame) { EndingGameController.HandleEndOfGameInput(); } else if (CurrentState == GameState.ViewingHighScores) { HighScoreController.HandleHighScoreInput(); } UtilityFunctions.UpdateAnimations(); }
/// <summary> /// Handles the user SwinGame. /// </summary> /// <remarks> /// Reads key and mouse input and converts these into /// actions for the game to perform. The actions /// performed depend upon the state of the game. /// </remarks> public static void HandleUserInput() { //Read incoming input events SwinGame.ProcessEvents(); switch (CurrentState) { case GameState.ViewingMainMenu: MenuController.HandleMainMenuInput(); break; case GameState.ViewingGameMenu: MenuController.HandleGameMenuInput(); break; case GameState.AlteringSettings: MenuController.HandleSetupMenuInput(); break; case GameState.Deploying: DeploymentController.HandleDeploymentInput(); break; case GameState.Discovering: DiscoveryController.HandleDiscoveryInput(); break; case GameState.EndingGame: EndingGameController.HandleEndOfGameInput(); break; case GameState.ViewingHighScores: HighScoreController.HandleHighScoreInput(); break; } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { if (UtilityFunctions.IsMouseInRectangle(HOME_BUTTON_LEFT, TOP_BUTTONS_TOP, HOME_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.AddNewState(GameState.ViewingGameMenu); } } UtilityFunctions.UpdateAnimations(); }
// Use this for initialization void Start() { //these are in here because the unity player has issues when resolution is set in the inspector and changed after a build has been created. //PlayerPrefs.DeleteAll(); //Application.Quit(); //set up gameobject references m_BoardController = m_Board.GetComponent <BoardController>(); m_CameraController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFollow>(); m_HighScoreController = GameObject.FindGameObjectWithTag("HighScoreSystem").GetComponent <HighScoreController>(); //set game state m_GameState = GameStates.Initialisation; //set up other variables m_CameraController.SetOffset(gameObject); m_Menu.SetActive(false); m_GameOverText.text = ""; }
void Start() { if (highScoreInstance == null) highScoreInstance = this; else if (highScoreInstance != this) Destroy(gameObject); }
void InitialiseScripts() { if(highScoreController==null){ highScoreController=GameObject.Find ("HighScoreObject").GetComponent<HighScoreController>(); } }
IEnumerator EndGame() { isEnemySpawn = false; // stop spawning enemy isPickUpSpawn = false; // stop spawning pick ups yield return new WaitForSeconds(endWait); // wait some time that player will se his death medalAwardingFor.SaveMedals(); // save all player medals information that will be necessary to display in gameOver screen SaveScores(); HighScoreController highScoreController = new HighScoreController(); highScoreController.SaveScoreInHighScore(score); // save player score in highscore GameObject.FindGameObjectWithTag("Canvas").GetComponent<MenuManager>().ShowMenu(gameOverMenu); // find MenuManager and switch menu to gameOver StopAllCoroutines(); // it prevents to spawn objects after end the game CursorController.instance.ShowCursor(); // player has possibility to move the cursor pause.StopPause(); // now player can't call the pause menu }
// Use this for initialization void Awake() { highScoreInstance = GetComponent<HighScoreController> (); highScore = new List<int>(); AssignTextFields (10); //SetExemplaryScore (); //SaveScore (); highScore.Clear (); //PlayerPrefs.DeleteAll (); LoadHighScores (); SetTop (10); DontDestroyOnLoad (gameObject); //DebugScores (); Debug.Log ("Start of HighScoreController"); }
// Use this for initialization void Start() { this._highScoreController = GameObject.FindWithTag ("HighScoreController").GetComponent ("HighScoreController") as HighScoreController; this.finalScoreLabel.text = "Score: " + this._highScoreController.finalScore; }
void Start() { highScoreController = gameObject.GetComponent<HighScoreController>(); }