public void Start() { if (HighScoreSystem == null) { Debug.LogAssertion("The savescore script did not have a HighScoreSystem referenced"); } if (textInput == null) { Debug.LogAssertion("The savescore script did not have the input field reference"); } if (GameManager == null) { Debug.LogAssertion("The game manager reference was not valid"); } highScoreSystem = HighScoreSystem.GetComponentInChildren <HighScoreSystem>(); loadPost = GameManager.GetComponentInChildren <LoadPostGame>(); input = textInput.GetComponent <InputField>(); if (loadPost == null) { Debug.LogAssertion("The game manager did not have a load post game script"); } if (highScoreSystem == null) { Debug.LogAssertion("The high score system reference did not have a high score system script"); } if (input == null) { Debug.LogAssertion("The text input object did not have an input field " + this.gameObject.ToString()); } }
private void OnTimeUp() { Time.timeScale = 0f; int currentScore = GameTracker.GetCurrentScore(); HighScoreSystem.SaveHighScore(currentScore); }
// Use this for initialization void Start() { Debug.Log("Drawing text"); if (HighScoreReference == null) { Debug.LogAssertion("The highScore object was not provided"); } highScore = HighScoreReference.GetComponent <HighScoreSystem>(); if (highScore == null) { Debug.LogAssertion("High score script was missing from highscore prefab"); } foreach (HighScoreSystem.NameToScore nameToScore in highScore.highScoreList) { GameObject newObject = new GameObject("Name Object", typeof(RectTransform)); Text textComponent = newObject.AddComponent <Text>(); newObject.transform.SetParent(this.transform); textComponent.text = nameToScore.nameValue; textComponent.font = Resources.GetBuiltinResource <Font>("Arial.ttf"); textComponent.alignment = TextAnchor.MiddleCenter; GameObject scoreObject = new GameObject("Score object", typeof(RectTransform)); Text scoreComponent = scoreObject.AddComponent <Text>(); scoreObject.transform.SetParent(this.transform); scoreComponent.text = nameToScore.scoreValue.ToString(); scoreComponent.font = Resources.GetBuiltinResource <Font>("Arial.ttf"); scoreComponent.alignment = TextAnchor.MiddleCenter; } }
//Moves the player to the direction specified IEnumerator slideToNewPos(Vector3 direction) { //If the player is not currently moving if (!movingCurrentlty) { movingCurrentlty = true;//The player is moving //If the player is moving up add a point if (direction == Vector3.up) { HighScoreSystem.AddPoint(); } //Keeps track of where abouts the player pos is between the starting point and the end point float inter = 0; float speed = Time.deltaTime * 12; //How fast the player is moving //Player Starting point at the beginning of animation Vector3 startPos = transform.position; //Player finishing point at the end of animation Vector3 endPos = startPos + direction; //While the player hasn't reached the finishing point while (inter < 1) { //Move the player inter += speed; transform.position = Vector3.Lerp(startPos, endPos, inter); yield return(new WaitForEndOfFrame()); } //Player is no longer moving movingCurrentlty = false; } }
public void EndGame() { HighScoreSystem.KrajIgre(Poeni.bodovi); FindObjectOfType <rotor>().enabled = false; FindObjectOfType <Poeni>().enabled = false; Klonovi.krajbrt = false; //Postavljamo krajbrt i nema vise instanciranja Animator.SetTrigger("GejmOverio"); }
private void Awake() { songSettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); sceneHandling = GameObject.FindGameObjectWithTag("SceneHandling").GetComponent <SceneHandling>(); scoreHandling = GameObject.FindGameObjectWithTag("ScoreHandling").GetComponent <ScoreHandling>(); scoreSystem = GameObject.FindGameObjectWithTag("HighScore").GetComponent <HighScoreSystem>(); scoreBoard = GetComponentInChildren <HighScoreBoard>(true); }
// Start is called before the first frame update void Start() { Debug.Log("HighScoreTester: Current Highscore = " + HighScoreSystem.LoadHighScore()); Debug.Log("HighScoreTester: Current Score = " + currentScore); if (HighScoreSystem.SaveHighScore(currentScore)) { Debug.Log("HighScoreTester: New Highscore"); } Debug.Log("HighScoreTester: Current Highscore = " + HighScoreSystem.LoadHighScore()); }
private void Awake() { #region Singleton if (Instance == null) { Instance = this; } if (Instance != this) { Destroy(gameObject); return; } #endregion }
private void OnTimeOut() { foreach (GameObject gameObject in resultOverlay) { gameObject.SetActive(true); } foreach (GameObject gameObject in gameOverlay) { gameObject.SetActive(false); } resultScoreText.text = GameTracker.GetCurrentScore().ToString(); resultHighscoreText.text = HighScoreSystem.LoadHighScore().ToString(); }
protected override void OnCreate() { highScoreSystem = World.GetOrCreateSystem <HighScoreSystem>(); RequireSingletonForUpdate <GameData>(); }
private void Awake() { scoreSystem = GameObject.FindGameObjectWithTag("HighScore").GetComponent <HighScoreSystem>(); content = transform.Find("Content").gameObject; content.SetActive(false); }
void Start() { HighScoreSystem.ResetScore(); movingCurrentlty = false; }
/// <summary> /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. /// </summary> protected override void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(this); LoadScores (); } else { Destroy(gameObject); } }
// Update is called once per frame void Update() { scoreText.text = HighScoreSystem.GetScore().ToString(); }