// Use this for initialization void Start() { GameMngr = GameObject.Find("GameEventManager"); ScoreDisplay = GameMngr.gameObject.GetComponent <DisplayScore> (); Player = GameObject.FindGameObjectWithTag("Player"); P_Stats = Player.gameObject.GetComponent <PlayerStats> (); }
public void Load() { if (PlayerPrefs.HasKey("maxScoreLeft")) { this.maxScoreLeft = PlayerPrefs.GetInt("maxScoreLeft"); } else { this.maxScoreLeft = 0; } if (PlayerPrefs.HasKey("maxScoreRight")) { this.maxScoreRight = PlayerPrefs.GetInt("maxScoreRight"); } else { this.maxScoreRight = 0; } //Debug.Log(achievements.gameObject.name); Achievements a = achievements.GetComponent <Achievements>(); DisplayScore d = ds.GetComponent <DisplayScore>(); a.loadResults(); d.updateText(this.maxScoreLeft, this.maxScoreRight); }
/// <summary> /// This checks for exit conditions (player reaches final destination or time is up) /// </summary> void CheckForExit() { if (game && timeStarted) // if game and time both are started then { currentTime = Time.time; float time_difference = currentTime - initTime; //store the difference of time timer.text = "Time : " + time_difference.ToString("0.00") + "s"; //display time in the text box if ((time_difference) > 60) //if time difference is greater than 60s, change the scene { DisplayScore.getTimeValues(time_difference); //send time values to Display score timeStarted = false; //assign time started as false SceneManager.LoadScene(4); //load display score scene } } float distance = Vector3.Distance(transform.position, spotlight.transform.position); if (distance <= 5.0f) //if user is near the final position { timeStarted = false; if (game) //if in game mode { DisplayScore.getTimeValues(currentTime - initTime); SceneManager.LoadScene(3); //load question answers scene } else { SceneManager.LoadScene(0); //if loses load main menu scene } } }
void Start() { _playerScore = GetComponent <PlayerScore>(); _displayScore = GameObject.Find("Canvas").transform.GetChild(0).gameObject.GetComponent <DisplayScore>(); ClearTableUI(); restartGame.gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { spawnInterval = Random.Range(3f, 5f); displayScore = GameObject.FindGameObjectWithTag("DisplayScoreText").GetComponent <DisplayScore>(); healthSystem = GameObject.FindGameObjectWithTag("HealthSystem").GetComponent <HealthSystem>(); //InvokeRepeating("SpawnRandomBall", startDelay, spawnInterval); StartCoroutine(SpawnRandomBallCoroutine()); }
public virtual void Draw(ISpriteBatch spriteBatch) { string scoreString = DisplayScore.ToString(); Vector2 measure = Font.MeasureString(scoreString); Vector2 origin = new Vector2(measure.X, measure.Y * 0.5f); spriteBatch.DrawString(Font, scoreString, ScorePosition.WorldPosition, Color.White, WorldRotation, origin, WorldScale, SpriteEffects.None, 0); }
// Use this for initialization void Start() { GameEventMngr = GameObject.Find("GameEventManager"); DisplayScr = GameEventMngr.GetComponent <DisplayScore> (); E_spawn = GameObject.Find("SpawnPoint01"); E_spawnScript = E_spawn.GetComponent <EnemySpawn> (); LootRoll = Random.Range(0, 100); LootID = Random.Range(0, LootTableSize); Debug.Log("LootID:" + LootID); }
// Start is called before the first frame update void Start() { //get reference to health system healthsystem = GameObject.FindGameObjectWithTag("HealthSystem").GetComponent <HealthSystem>(); //get reference to display score displayscore = GameObject.FindGameObjectWithTag("DisplayScoreText").GetComponent <DisplayScore>(); //InvokeRepeating("SpawnRandomBall", startDelay, spawnInterval); StartCoroutine(SpawnCoroutine()); }
private void _ToMenu() { PackedScene target = GD.Load("res://Scenes/DisplayScore/DisplayScore.tscn") as PackedScene; DisplayScore scene = (DisplayScore)target.Instance(); scene.Score = Math.Round(Score.Percent * 100).ToString(); for (int i = 0; i < GetChildCount(); i += 1) { GetChild(i).QueueFree(); } QueueFree(); GetTree().Root.AddChild(scene); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } tmpPosition = displayTemp.rectTransform.anchoredPosition; targetPosition = tmpPosition + new Vector2(0f, -70f); }
public void Draw() { // DrawBackground(); //DrawLife(); DisplayScore timing = new DisplayScore(_gameWindow); timing.Draw(); foreach (Robot a in _robots)//all Linklist's elements draw one by one { a.Draw(); } _player.Draw(); DisplayLife life = new DisplayLife(_gameWindow); life.Draw(); DrawLife(); _gameWindow.Refresh(60); }
private void Awake() { displayScore = FindObjectOfType <DisplayScore>(); }
void Awake() { highscoreDisplay = GetComponent <DisplayScore>(); instance = this; }
public static void Hit() { currentstroke++; DisplayScore.Hit(); }
private void Start() { displayscore = GameObject.FindGameObjectWithTag("DisplayScoreText").GetComponent <DisplayScore>(); }
void Awake() { instance = this; highscoresDisplay = GetComponent <DisplayScore>(); }
void Start() { displayScoreScript = GameObject.FindGameObjectWithTag("DisplayScoreText").GetComponent <DisplayScore>(); }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Enemycar") { Destroy(col.gameObject); fm.setCollision(true); StartCoroutine(MoveBack(crashSpeed)); fm.setCollision(false); if (score >= 5) { score = score - 5; } else { score = 0; } DisplayScore displayer = controller.GetComponent <DisplayScore>(); displayer.updateScore(score); GameObject.FindGameObjectWithTag("CoinSound").GetComponent <TestPlaying>().Bump(); } if (col.gameObject.tag == "coin") { Destroy(col.gameObject); score++; DisplayScore displayer = controller.GetComponent <DisplayScore>(); displayer.updateScore(score); GameObject.FindGameObjectWithTag("CoinSound").GetComponent <TestPlaying>().Bing(); } if (col.gameObject.tag == "red_coin") { Destroy(col.gameObject); score = score + 10; DisplayScore displayer = controller.GetComponent <DisplayScore>(); displayer.updateScore(score); GameObject.FindGameObjectWithTag("CoinSound").GetComponent <TestPlaying>().Bing(); } if (col.gameObject.tag == "Fuel") { controller.GetComponent <Boost>().ActivateBoost(); Destroy(col.gameObject); GameObject.FindGameObjectWithTag("CoinSound").GetComponent <TestPlaying>().BoostSound(); } if (col.gameObject.tag == "Tyre") { Destroy(col.gameObject); if (score >= 3) { score = score - 3; } else { score = 0; } DisplayScore displayer = controller.GetComponent <DisplayScore>(); displayer.updateScore(score); GameObject.FindGameObjectWithTag("CoinSound").GetComponent <TestPlaying>().Bump(); } //else if (col.gameObject.tag == "Tree") //{ // // Physics.IgnoreCollision(col.GetComponent<Collider>(), GetComponent<Collider>()); // } }