void Start() { saveController = new SaveLoadController(); saveController.CheckForSave(); Data = new GameData(); player = Instantiate(playerPrefab, playerStart.position, playerStart.rotation) as GameObject; spawner = spawnerObject.transform.GetChild(0).GetComponent <Spawner>(); UpdateInvertPreference(isInverted); UIManager.Instance.SetMessage("Destroy the Spawner"); UIManager.Instance.UpdateBestTime(saveController.GetBestTime()); Invoke("ClearMessage", 3f); }
public void NotifySpawnerDead() { spawnerDead = true; UIManager.Instance.SetMessage("Spawner Destroyed"); float previousBestTime = saveController.GetBestTime(); if (gameTime < previousBestTime || previousBestTime == 0f) { Debug.LogFormat("New best time! was: {0}, now: {1}", previousBestTime, gameTime); Data.bestTime = gameTime; saveController.UpdateData(Data); } Time.timeScale = 0.25f; Invoke("Restart", 2f); }