|
|
@@ -6,9 +6,6 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
|
private SaveManager saveManager;
|
|
|
private TimeManager timeManager;
|
|
|
- private Material skybox;
|
|
|
- private Color globalLightColor;
|
|
|
- private Quaternion globalLightRotation;
|
|
|
|
|
|
private GameObject player;
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
|
@@ -21,9 +18,6 @@ public class GameManager : MonoBehaviour
|
|
|
//Get components
|
|
|
saveManager = GetComponent<SaveManager>();
|
|
|
timeManager = GetComponent<TimeManager>();
|
|
|
- skybox = RenderSettings.skybox;
|
|
|
- globalLightColor = timeManager.globalLight.color;
|
|
|
- globalLightRotation = timeManager.globalLight.transform.rotation;
|
|
|
|
|
|
data = saveManager.LoadGame();
|
|
|
if (data != null)
|
|
|
@@ -53,9 +47,16 @@ public class GameManager : MonoBehaviour
|
|
|
#region DaylightCycle
|
|
|
data.minutes = timeManager.Minutes;
|
|
|
data.hours = timeManager.Hours;
|
|
|
- data.skybox = skybox;
|
|
|
- data.globalLightColor = globalLightColor;
|
|
|
- data.globalLightRotation = globalLightRotation;
|
|
|
+ data.skybox = RenderSettings.skybox;
|
|
|
+ data.globalLightColor = timeManager.globalLight.color;
|
|
|
+ data.globalLightRotation = timeManager.globalLight.transform.rotation;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Stamina
|
|
|
+ data.currentStamina = player.GetComponent<Stamina>().GetCurrentStamina();
|
|
|
+ data.maxStamina = player.GetComponent<Stamina>().maxStamina;
|
|
|
+ data.canSprint = player.GetComponent<Stamina>().GetCanSprint();
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
@@ -67,10 +68,15 @@ public class GameManager : MonoBehaviour
|
|
|
#region DaylightCycle
|
|
|
timeManager.Minutes = data.minutes;
|
|
|
timeManager.Hours = data.hours;
|
|
|
- skybox = data.skybox;
|
|
|
- globalLightColor = data.globalLightColor;
|
|
|
+ RenderSettings.skybox = data.skybox;
|
|
|
+ timeManager.globalLight.color = data.globalLightColor;
|
|
|
RenderSettings.fogColor = data.globalLightColor;
|
|
|
- globalLightRotation = data.globalLightRotation;
|
|
|
+ timeManager.globalLight.transform.rotation = data.globalLightRotation;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Stamina
|
|
|
+ player.GetComponent<Stamina>().Reinit(data.currentStamina, data.maxStamina, data.canSprint);
|
|
|
|
|
|
#endregion
|
|
|
|