// Use this for initialization void Start() { time = FindObjectOfType<GameTimeScript>(); tile_map = FindObjectOfType<TileMapScript>(); schedule = FindObjectOfType<ScheduleScript>(); path_finder = gameObject.AddComponent<WorldGenerator>(); is_moving = false; schedule.loadSchedule("schedule_data.bin"); Application.runInBackground = true; }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Player") { //update score based on time completing map Score s = GameObject.Find("Score").GetComponent <Score>(); GameTimeScript gametime = GameObject.Find("GameTimeDisplay").GetComponent <GameTimeScript>(); s.score += 40000 / gametime.GetTimeInSeconds(); //change this to modify score scaling with time completion **NOTE: POORLY BALANCED SCORING METHOD SceneManager.LoadScene(nextLevel); } }
public void UpdateScore(string sceneName) { //score += points; scoreText.text = "Score: " + score.ToString(); if (score > PlayerPrefs.GetInt("HighScore" + sceneName, 0)) { GameTimeScript gametime = GameObject.Find("GameTimeDisplay").GetComponent <GameTimeScript>(); PlayerPrefs.SetInt("HighScore" + sceneName, score); PlayerPrefs.SetString("HighScore" + sceneName + "Time", gametime.GetTimeText()); highScore.text = "High Score: " + score.ToString(); highScoreTime.text = gametime.GetTimeText(); } }