/* Taylor: * Checks to see if load function has been called * In SaveLoad.cs, LoadScene is set to true when activated * Saved data is copied to the GameManagers localData * Health object uses setupScene to number of hearts and the gui * Moves player to saved position * Sets LoadingScene to false to indicate loading is over */ public void IsLoadingGame() { if (SaveLoad.Instance.LoadingScene) { GameManager.Instance.localData = SaveLoad.Instance.LocalData; health.SetupScene(SaveLoad.Instance.LocalData.Health); lastCheckpoint = new Vector3(SaveLoad.Instance.LocalData.LastCheckpointX, SaveLoad.Instance.LocalData.LastCheckpointY); if (lastCheckpoint == GameObject.Find("star").transform.position) { Destroy(GameObject.Find("star")); } transform.position = lastCheckpoint; SaveLoad.Instance.LoadingScene = false; } }
/* Taylor: * Checks to see if load function has been called * In SaveLoad.cs, LoadScene is set to true when activated * Saved data is copied to the GameManagers localData * Health object uses setupScene to number of hearts and the gui * Moves player to saved position * Sets LoadingScene to false to indicate loading is over */ public void IsLoadingGame() { if (SaveLoad.Instance.LoadingScene) { GameManager.Instance.localData = SaveLoad.Instance.LocalData; health.SetupScene(SaveLoad.Instance.LocalData.Health); lastCheckpoint = new Vector3(SaveLoad.Instance.LocalData.LastCheckpointX, SaveLoad.Instance.LocalData.LastCheckpointY); for (int i = 0; i < checkpointArray.Length; i++) { if (lastCheckpoint.x >= checkpointArray[i].transform.position.x) { Destroy(checkpointArray[i]); } } transform.position = lastCheckpoint; SaveLoad.Instance.LoadingScene = false; } }