diff --git a/Assets/Scenes/TestPoly.unity b/Assets/Scenes/TestPoly.unity index 34bd86e9..b6d3885e 100644 --- a/Assets/Scenes/TestPoly.unity +++ b/Assets/Scenes/TestPoly.unity @@ -262,9 +262,9 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 31.139944, y: 643.26227} + m_AnchoredPosition: {x: 1826.2748, y: -322.1232} m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.47404256, y: 1.0939045} + m_Pivot: {x: 1.451873, y: 0.17039108} --- !u!114 &3676872 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2092,7 +2092,7 @@ MonoBehaviour: _maxSunLightIntensity: 1 _moonLight: {fileID: 448269317} _maxMoonLightIntensity: 0.5 - _minuteToRealTime: 0.5 + _minuteToRealTime: 0.01 --- !u!4 &307039700 Transform: m_ObjectHideFlags: 0 @@ -3872,10 +3872,10 @@ RectTransform: m_Father: {fileID: 1985043055} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -35.11} + m_SizeDelta: {x: 970, y: 60.22} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &630928164 MonoBehaviour: @@ -4014,19 +4014,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 70.94 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 22.35 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.x @@ -4034,23 +4034,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16.175 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 80.94 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 32.35 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.x @@ -4058,7 +4058,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16.175 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_Pivot.x @@ -4078,7 +4078,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.x @@ -4086,15 +4086,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 80.94 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 32.35 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_LocalPosition.x @@ -4130,7 +4130,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -21.175 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -4504,10 +4504,10 @@ RectTransform: m_Father: {fileID: 1429085339} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 495, y: 0} - m_SizeDelta: {x: 990, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -25.11} + m_SizeDelta: {x: 990, y: 50.22} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &693123251 MonoBehaviour: @@ -4704,7 +4704,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &701546108 RectTransform: m_ObjectHideFlags: 0 @@ -7187,10 +7187,10 @@ RectTransform: m_Father: {fileID: 693123250} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 495, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -25.11} + m_SizeDelta: {x: 146.9, y: 40.22} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &961850262 MonoBehaviour: @@ -7535,19 +7535,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 66.75 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 22.35 objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.x @@ -7555,23 +7555,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703089782041, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16.175 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 76.75 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 32.35 objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.x @@ -7579,7 +7579,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516703338386383, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16.175 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_Pivot.x @@ -7599,7 +7599,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.x @@ -7607,15 +7607,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 76.75 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 32.35 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_LocalPosition.x @@ -7651,7 +7651,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -21.175 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -9106,10 +9106,10 @@ RectTransform: m_Father: {fileID: 630928163} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 130, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 130, y: -10} + m_SizeDelta: {x: 250, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1273198788 MonoBehaviour: @@ -15018,10 +15018,10 @@ RectTransform: m_Father: {fileID: 701546108} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 495, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -81.395004} + m_SizeDelta: {x: 990, y: 162.79001} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1429085340 MonoBehaviour: @@ -15894,10 +15894,10 @@ RectTransform: m_Father: {fileID: 1429085339} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 495, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -141.615} + m_SizeDelta: {x: 187.69, y: 42.35} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1537379607 MonoBehaviour: @@ -18274,10 +18274,10 @@ RectTransform: m_Father: {fileID: 1429085339} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 495, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 495, y: -85.33} + m_SizeDelta: {x: 990, y: 70.22} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1985043056 MonoBehaviour: @@ -19784,10 +19784,10 @@ RectTransform: m_Father: {fileID: 630928163} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 615, y: 0} - m_SizeDelta: {x: 0, y: 40.22} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 615, y: -30.11} + m_SizeDelta: {x: 700, y: 40.22} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2075350865 MonoBehaviour: diff --git a/Assets/Scripts/Actions/Eat.cs b/Assets/Scripts/Actions/Eat.cs index 7eb0eb88..d04ea848 100644 --- a/Assets/Scripts/Actions/Eat.cs +++ b/Assets/Scripts/Actions/Eat.cs @@ -2,7 +2,7 @@ namespace Assets.Scripts.Actions { - public class Eat : IPlayerAction, Interfaces.ISellable + public class Eat : IPlayerAction, ISellable { public decimal Price { get; private set; } diff --git a/Assets/Scripts/TimeManager.cs b/Assets/Scripts/TimeManager.cs index 1fcfb74d..9ec4fcf4 100644 --- a/Assets/Scripts/TimeManager.cs +++ b/Assets/Scripts/TimeManager.cs @@ -40,15 +40,16 @@ public class TimeManager : MonoBehaviour private float _timer; [SerializeField] - private float _minuteToRealTime = 0.01f; + private float _minuteToRealTime = 0.05f; - public static TimeSpan CurrentTime { get; private set; } + private static TimeSpan _currentTime; + public static TimeSpan CurrentTime => _currentTime; // Start is called before the first frame update void Start() { _timer = _minuteToRealTime; - CurrentTime = TimeSpan.Zero + TimeSpan.FromHours(_startHour); + _currentTime = TimeSpan.Zero + TimeSpan.FromHours(_startHour); _sunriseTime = TimeSpan.FromHours(_sunriseHour); _sunsetTime = TimeSpan.FromHours(_sunsetHour); } @@ -57,7 +58,7 @@ public class TimeManager : MonoBehaviour void Update() { UpdateTime(); - //RotateSun(); + RotateSun(); } private void UpdateTime() @@ -65,36 +66,37 @@ public class TimeManager : MonoBehaviour _timer -= Time.deltaTime; if (_timer <= 0) { - CurrentTime = CurrentTime.Add(TimeSpan.FromMinutes(1)); + _currentTime = _currentTime.Add(TimeSpan.FromMinutes(1)); OnMinuteChanged?.Invoke(); _timer = _minuteToRealTime; } } - //private void RotateSun() - //{ - // float sunLightRotation; - // if (_currentTime.TimeOfDay > _sunriseTime && _currentTime.TimeOfDay < _sunsetTime) - // { - // TimeSpan sunriseToSunsetDuration = CalculateTimeDifference(_sunriseTime, _sunsetTime); - // TimeSpan timeSinceSunrise = CalculateTimeDifference(_sunriseTime, _currentTime.TimeOfDay); + private void RotateSun() + { - // double percentage = timeSinceSunrise.TotalMinutes / sunriseToSunsetDuration.TotalMinutes; + float sunLightRotation; + if (_currentTime > _sunriseTime && _currentTime < _sunsetTime) + { + TimeSpan sunriseToSunsetDuration = CalculateTimeDifference(_sunriseTime, _sunsetTime); + TimeSpan timeSinceSunrise = CalculateTimeDifference(_sunriseTime, _currentTime); - // sunLightRotation = Mathf.Lerp(0, 180, (float)percentage); - // } - // else - // { - // TimeSpan nightDuration = CalculateTimeDifference(_sunsetTime, _sunriseTime); - // TimeSpan timeSinceSunset = CalculateTimeDifference(_sunsetTime, _currentTime.TimeOfDay); + double percentage = timeSinceSunrise.TotalMinutes / sunriseToSunsetDuration.TotalMinutes; - // double percentage = timeSinceSunset.TotalMinutes / nightDuration.TotalMinutes; + sunLightRotation = Mathf.Lerp(0, 180, (float)percentage); + } + else + { + TimeSpan nightDuration = CalculateTimeDifference(_sunsetTime, _sunriseTime); + TimeSpan timeSinceSunset = CalculateTimeDifference(_sunsetTime, _currentTime); - // sunLightRotation = Mathf.Lerp(180, 360, (float)percentage); - // } - // _sunLight.transform.rotation = Quaternion.AngleAxis(sunLightRotation, Vector3.right); - //} + double percentage = timeSinceSunset.TotalMinutes / nightDuration.TotalMinutes; + + sunLightRotation = Mathf.Lerp(180, 360, (float)percentage); + } + _sunLight.transform.rotation = Quaternion.AngleAxis(sunLightRotation, Vector3.right); + } private void UpdateLightSettings() {