time to bed

This commit is contained in:
2023-03-08 13:40:01 +02:00
parent 1c8876c99c
commit bcaa786e7c
7 changed files with 1362 additions and 38 deletions
File diff suppressed because it is too large Load Diff
+34 -22
View File
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.172768, g: 0.21589169, b: 0.29782546, a: 1}
m_IndirectSpecularColor: {r: 0.17276844, g: 0.21589246, b: 0.2978263, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -936,7 +936,7 @@ Transform:
- {fileID: 2110938952}
- {fileID: 1930563420}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &294733042
GameObject:
@@ -1886,7 +1886,7 @@ PrefabInstance:
- target: {fileID: 3284961431740112560, guid: c0021857f236ae341a3c917b9da4dfaf,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 3284961431740112560, guid: c0021857f236ae341a3c917b9da4dfaf,
type: 3}
@@ -2449,8 +2449,8 @@ RectTransform:
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: 50}
m_AnchoredPosition: {x: 182.005, y: 0}
m_SizeDelta: {x: 364.01, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &771379432
MonoBehaviour:
@@ -2528,7 +2528,7 @@ RectTransform:
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_AnchoredPosition: {x: 182.005, y: 0}
m_SizeDelta: {x: 0, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &815467878
@@ -2958,7 +2958,7 @@ RectTransform:
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_AnchoredPosition: {x: 957.94086, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &927596948
@@ -3247,7 +3247,7 @@ RectTransform:
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_AnchoredPosition: {x: 674.0475, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &952219226
@@ -3503,7 +3503,6 @@ Transform:
m_Children:
- {fileID: 307039700}
- {fileID: 1689632238}
- {fileID: 1550470211}
m_Father: {fileID: 1488006971}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -9256,7 +9255,7 @@ Transform:
m_Children:
- {fileID: 1838394470}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1368465711
GameObject:
@@ -9541,7 +9540,7 @@ RectTransform:
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_AnchoredPosition: {x: 20, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1503626360
@@ -9883,6 +9882,7 @@ GameObject:
- component: {fileID: 1550470211}
- component: {fileID: 1550470210}
- component: {fileID: 1550470209}
- component: {fileID: 1550470212}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
@@ -9937,9 +9937,21 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 971260931}
m_RootOrder: 2
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1550470212
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1550470208}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59acbdefe19456b4093c8081fc195458, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1568871088 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2402651526520908900, guid: c0021857f236ae341a3c917b9da4dfaf,
@@ -9988,7 +10000,7 @@ Transform:
m_Children:
- {fileID: 358062558}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1600157251
GameObject:
@@ -10188,7 +10200,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1689632236
GameObject:
@@ -10542,7 +10554,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1750970806
GameObject:
@@ -10820,7 +10832,7 @@ RectTransform:
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_AnchoredPosition: {x: 275.15417, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1811096135
@@ -11042,7 +11054,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 182.005
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -11365,7 +11377,7 @@ RectTransform:
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_AnchoredPosition: {x: 182.005, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1964284071
@@ -16126,7 +16138,7 @@ Transform:
- {fileID: 1526894738}
- {fileID: 294733043}
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &543839634859946773
GameObject:
@@ -29137,7 +29149,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4652948641423679027}
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071067}
m_LocalPosition: {x: -9.080154, y: -0, z: -62.99}
m_LocalPosition: {x: -9.080154, y: 0, z: -62.15678}
m_LocalScale: {x: 100, y: 100, z: 100}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -78514,7 +78526,7 @@ PrefabInstance:
- target: {fileID: 9142730712074959070, guid: 7532f144834b4d24ab75d734dfdaf51d,
type: 3}
propertyPath: m_RootOrder
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9142730712074959070, guid: 7532f144834b4d24ab75d734dfdaf51d,
type: 3}
+10 -1
View File
@@ -2,8 +2,17 @@ using UnityEngine;
public class DontDestroy : MonoBehaviour
{
public static DontDestroy Instance { get; private set; }
private void Awake()
{
DontDestroyOnLoad(gameObject);
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
Destroy(gameObject);
}
}
+10 -1
View File
@@ -1,11 +1,20 @@
using System;
using UnityEngine;
public class Bed : BaseInteractableObject
{
private Player _player;
public override void Interact(Player player)
{
_player=player;
Debug.Log("Sitting");
player.SetPlayerAnimation(AnimationStates.Sitting);
TimeManager.Instance.FastForward(TimeSpan.FromHours(8), OnFastForwardEnd);
}
private void OnFastForwardEnd()
{
_player.SetPlayerAnimation(AnimationStates.Standing);
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ public class MouseInputManager : MonoBehaviour
private WaypointVisual _waypointVisual;
public event EventHandler<OnSelectedObjectChangedEventArgs> OnSelectedObjectChanged;
public static event EventHandler<OnSelectedObjectChangedEventArgs> OnSelectedObjectChanged;
public static MouseInputManager Instance { get; private set; }
+4 -2
View File
@@ -10,12 +10,14 @@ public class SelectedVisual : MonoBehaviour
private void Start()
{
MouseInputManager.Instance.OnSelectedObjectChanged += Mouse_OnSelectedObjectChanged;
MouseInputManager.OnSelectedObjectChanged += Mouse_OnSelectedObjectChanged;
print($"{_selectedObject.name} is subscribed to OnSelectedObjectChanged");
}
private void OnDestroy()
{
MouseInputManager.Instance.OnSelectedObjectChanged -= Mouse_OnSelectedObjectChanged;
MouseInputManager.OnSelectedObjectChanged -= Mouse_OnSelectedObjectChanged;
print($"{_selectedObject.name} is Unsubscribed to OnSelectedObjectChanged");
}
private void Mouse_OnSelectedObjectChanged(object sender, OnSelectedObjectChangedEventArgs e)
+37 -4
View File
@@ -1,8 +1,13 @@
using System;
using System.Collections;
using UnityEngine;
public class TimeManager : MonoBehaviour
{
public static TimeManager Instance { get; private set; }
private const float MINUTE_TIME = 0.5f;
public static Action OnMinuteChanged;
[SerializeField]
@@ -22,16 +27,31 @@ public class TimeManager : MonoBehaviour
private float _timer;
private float _sunInitialIntensity;
[SerializeField]
private float _minuteToRealTime = 0.05f;
private float _minuteToRealTime;
private static TimeSpan _currentTime;
public static TimeSpan CurrentTime => _currentTime;
private TimeSpan _timeToStop;
private Action _callBackOnFastForward;
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
Destroy(gameObject);
}
// Start is called before the first frame update
void Start()
{
// _sunInitialIntensity = _sunLight.intensity;
// _sunInitialIntensity = _sunLight.intensity;
_timer = _minuteToRealTime;
_currentTime = TimeSpan.Zero + TimeSpan.FromHours(_startHour);
_sunriseTime = TimeSpan.FromHours(_sunriseHour);
@@ -53,10 +73,23 @@ public class TimeManager : MonoBehaviour
_currentTime = _currentTime.Add(TimeSpan.FromMinutes(1));
OnMinuteChanged?.Invoke();
if (_currentTime.TotalMinutes >= _timeToStop.TotalMinutes)
{
_minuteToRealTime = MINUTE_TIME;
_timeToStop = TimeSpan.MaxValue;
_callBackOnFastForward.Invoke();
}
_timer = _minuteToRealTime;
}
}
public void FastForward(TimeSpan timeToStop,Action callBack)
{
_timeToStop = _currentTime.Add(timeToStop);
_minuteToRealTime = 0.03f;
_callBackOnFastForward= callBack;
}
private void RotateSun()
{
float intensityMultiplier = 1;
@@ -73,7 +106,7 @@ public class TimeManager : MonoBehaviour
{
intensityMultiplier = 0;
}
// _sunLight.intensity = _sunInitialIntensity * intensityMultiplier;
// _sunLight.intensity = _sunInitialIntensity * intensityMultiplier;
}
private TimeSpan CalculateTimeDifference(TimeSpan from, TimeSpan to)