Fixed current day of week calculation
This commit is contained in:
parent
81cbff9cab
commit
b42ba4a9b1
File diff suppressed because it is too large
Load Diff
|
@ -378,8 +378,6 @@ MonoBehaviour:
|
||||||
_secondsPerDay: 5
|
_secondsPerDay: 5
|
||||||
_totalTime: 0
|
_totalTime: 0
|
||||||
_sun: {fileID: 179279866}
|
_sun: {fileID: 179279866}
|
||||||
_currentWeekday: 0
|
|
||||||
stringgy:
|
|
||||||
--- !u!4 &227416519
|
--- !u!4 &227416519
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -395,74 +393,6 @@ Transform:
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &283529456
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 283529458}
|
|
||||||
- component: {fileID: 283529457}
|
|
||||||
- component: {fileID: 283529459}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Game Manager
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 2800000, guid: 9eff477e4332346818c96745043dae9e, type: 3}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!114 &283529457
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 283529456}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 4c31bfd8f0f10f540b73de81aac6d46c, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_difficulty: 1
|
|
||||||
_totalGameDurationSeconds: 0
|
|
||||||
_remainingGameDurationSeconds: 0
|
|
||||||
_currentEfficiency: 0
|
|
||||||
_developers:
|
|
||||||
- {fileID: 283529459}
|
|
||||||
_gameRunning:
|
|
||||||
_falseness: 1
|
|
||||||
--- !u!4 &283529458
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 283529456}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &283529459
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 283529456}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 6dcc72027d5c35441a351fdb5140b0f8, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_baseEfficiency: 1
|
|
||||||
_currentCurrentEfficiency: 1
|
|
||||||
_fingersLeft: 10
|
|
||||||
--- !u!1 &547927580
|
--- !u!1 &547927580
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1469,6 +1399,63 @@ RectTransform:
|
||||||
m_AnchoredPosition: {x: 117, y: -217.6}
|
m_AnchoredPosition: {x: 117, y: -217.6}
|
||||||
m_SizeDelta: {x: 200, y: 50}
|
m_SizeDelta: {x: 200, y: 50}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!1001 &1648641904
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 2703668081068178613, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: GameManager
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2715764554523923620, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
--- !u!1 &1737307722
|
--- !u!1 &1737307722
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1567,7 +1554,7 @@ SceneRoots:
|
||||||
m_Roots:
|
m_Roots:
|
||||||
- {fileID: 1737307725}
|
- {fileID: 1737307725}
|
||||||
- {fileID: 179279867}
|
- {fileID: 179279867}
|
||||||
- {fileID: 283529458}
|
|
||||||
- {fileID: 227416519}
|
- {fileID: 227416519}
|
||||||
- {fileID: 4836486}
|
- {fileID: 4836486}
|
||||||
- {fileID: 845814462}
|
- {fileID: 845814462}
|
||||||
|
- {fileID: 1648641904}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
|
||||||
{
|
{
|
||||||
TimeManager.Instance.Init();
|
TimeManager.Instance.Init();
|
||||||
|
|
||||||
_totalGameDurationSeconds = TimeManager.Instance.CalculateActualDeveloperTime(_difficulty);
|
_totalGameDurationSeconds = TimeManager.Instance.CalculateActualDeveloperTime(_difficulty, 4);
|
||||||
|
|
||||||
_remainingGameDurationSeconds = _totalGameDurationSeconds;
|
_remainingGameDurationSeconds = _totalGameDurationSeconds;
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,12 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||||
|
|
||||||
[SerializeField] private Light _sun;
|
[SerializeField] private Light _sun;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private Weekday _currentWeekday;
|
|
||||||
|
|
||||||
private DateTime _startDate;
|
private DateTime _startDate;
|
||||||
private DateTime _deadline;
|
private DateTime _deadline;
|
||||||
|
|
||||||
public int DaysLeft => _daysUntilRelease;
|
public int DaysLeft => _daysUntilRelease;
|
||||||
|
|
||||||
public Weekday CurrentWeekday => _currentWeekday;
|
public DayOfWeek CurrentDayOfWeek => CurrentDate.DayOfWeek;
|
||||||
|
|
||||||
public TimeSpan TimeOfDay => CurrentDate.TimeOfDay;
|
public TimeSpan TimeOfDay => CurrentDate.TimeOfDay;
|
||||||
|
|
||||||
|
@ -48,9 +45,6 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool MissedDeadline => CurrentDate > Deadline;
|
public bool MissedDeadline => CurrentDate > Deadline;
|
||||||
|
|
||||||
[SerializeField, ShowOnly]
|
|
||||||
private string stringgy;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_startDate = new DateTime(2024, 4, 2, 12, 0, 0);
|
_startDate = new DateTime(2024, 4, 2, 12, 0, 0);
|
||||||
|
@ -60,11 +54,11 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Berechnet die (real life) Sekunden, die die Entwickler bei 100% Effizienz benötigen um das Spiel bei gegebener Schwierigkeit zu entwickeln.
|
/// Berechnet die (real life) Sekunden, die die Entwickler bei 100% Effizienz benötigen um das Spiel bei gegebener Schwierigkeit zu entwickeln.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double CalculateActualDeveloperTime(Difficulty difficulty)
|
public double CalculateActualDeveloperTime(Difficulty difficulty, int developerCount)
|
||||||
{
|
{
|
||||||
DifficultySettings settings = difficulty.GetSettings();
|
DifficultySettings settings = difficulty.GetSettings();
|
||||||
|
|
||||||
return _daysUntilRelease * _secondsPerDay / settings.DaysUntilReleaseFactor;
|
return (_daysUntilRelease * _secondsPerDay * developerCount) / settings.DaysUntilReleaseFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
|
@ -84,10 +78,7 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||||
{
|
{
|
||||||
_totalTime -= 1.0;
|
_totalTime -= 1.0;
|
||||||
_daysUntilRelease--;
|
_daysUntilRelease--;
|
||||||
_currentWeekday = _currentWeekday.GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stringgy = TimeOfDay.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSun()
|
private void UpdateSun()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using UnityEngine;
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Utility
|
namespace Utility
|
||||||
{
|
{
|
||||||
|
@ -23,10 +24,18 @@ namespace Utility
|
||||||
else if (_instance != value)
|
else if (_instance != value)
|
||||||
{
|
{
|
||||||
Debug.LogError("Instance already exists. Deleting duplicate.");
|
Debug.LogError("Instance already exists. Deleting duplicate.");
|
||||||
|
|
||||||
|
if (Application.isEditor)
|
||||||
|
{
|
||||||
|
DestroyImmediate(value.gameObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Destroy(value.gameObject);
|
Destroy(value.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks>Wenn du diese methode überlädst, rufe auf jeden Fall base.Awake() auf!</remarks>
|
/// <remarks>Wenn du diese methode überlädst, rufe auf jeden Fall base.Awake() auf!</remarks>
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
|
@ -40,9 +49,12 @@ namespace Utility
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAfterDeserialize()
|
public void OnAfterDeserialize()
|
||||||
|
{
|
||||||
|
if (!Application.isEditor)
|
||||||
{
|
{
|
||||||
// The value of Instance is lost after deserialization, so we need to set it again.
|
// The value of Instance is lost after deserialization, so we need to set it again.
|
||||||
Instance = (T)this;
|
Instance = (T)this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Utility
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public struct SimpleTime
|
||||||
|
{
|
||||||
|
[SerializeField, Range(0, 23)]
|
||||||
|
private byte _hour;
|
||||||
|
[SerializeField, Range(0, 59)]
|
||||||
|
private byte _minutes;
|
||||||
|
|
||||||
|
public int Hour
|
||||||
|
{
|
||||||
|
get => _hour;
|
||||||
|
set => _hour = (byte)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Minute
|
||||||
|
{
|
||||||
|
get => _minutes;
|
||||||
|
set => _minutes = (byte)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan ToTimeSpan() => new(_hour, _minutes, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 012fa3bc180f42f396fca3a7a6c4fb5b
|
||||||
|
timeCreated: 1712316058
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Utility
|
||||||
|
{
|
||||||
|
public static class TimeSpanExtension
|
||||||
|
{
|
||||||
|
public static bool IsBetween(this TimeSpan value, TimeSpan start, TimeSpan end)
|
||||||
|
{
|
||||||
|
if (start > end)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(nameof(start), "start must be before end.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return value >= start && value <= end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d76aeb99bb254637b57aa6f86d764c01
|
||||||
|
timeCreated: 1712316955
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Utility
|
using System;
|
||||||
|
|
||||||
|
namespace Utility
|
||||||
{
|
{
|
||||||
public enum Weekday
|
public enum Weekday
|
||||||
{
|
{
|
||||||
|
@ -41,4 +43,35 @@
|
||||||
_ => "Unbekannt"
|
_ => "Unbekannt"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class DayOfWeekExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den Wochentag zurück, der auf den gegebenen Wochentag folgt.
|
||||||
|
/// </summary>
|
||||||
|
public static DayOfWeek GetNext(this DayOfWeek current) => GetFutureDay(current, 1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den Wochentag zurück, der in der gegebenen Anzahl an Tagen auf den gegebenen Wochentag folgt.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="current">Der aktuelle Wochentag.</param>
|
||||||
|
/// <param name="days">Die Anzahl an Tagen, die vergehen sollen.</param>
|
||||||
|
public static DayOfWeek GetFutureDay(this DayOfWeek current, int days) =>
|
||||||
|
(DayOfWeek)(((int)current + days) % 7);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den deutschen Namen des Wochentags zurück.
|
||||||
|
/// </summary>
|
||||||
|
public static string GetName(this DayOfWeek weekday) => weekday switch
|
||||||
|
{
|
||||||
|
DayOfWeek.Monday => "Montag",
|
||||||
|
DayOfWeek.Tuesday => "Dienstag",
|
||||||
|
DayOfWeek.Wednesday => "Mittwoch",
|
||||||
|
DayOfWeek.Thursday => "Donnerstag",
|
||||||
|
DayOfWeek.Friday => "Freitag",
|
||||||
|
DayOfWeek.Saturday => "Samstag",
|
||||||
|
DayOfWeek.Sunday => "Sonntag",
|
||||||
|
_ => "Unbekannt"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -30,7 +30,7 @@ public class TerribleUiController : MonoBehaviour
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
_weekdayText.text = TimeManager.Instance.CurrentWeekday.GetName();
|
_weekdayText.text = TimeManager.Instance.CurrentDayOfWeek.GetName();
|
||||||
_dayTimeText.text = $"Day Time: {TimeManager.Instance.TimeOfDay:h\\:mm\\:ss}";
|
_dayTimeText.text = $"Day Time: {TimeManager.Instance.TimeOfDay:h\\:mm\\:ss}";
|
||||||
_progressText.text = $"Progress: {(GameManager.Instance.GameProgress * 100.0):F3}%";
|
_progressText.text = $"Progress: {(GameManager.Instance.GameProgress * 100.0):F3}%";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Utility;
|
||||||
|
|
||||||
|
public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
|
||||||
|
{
|
||||||
|
private TimeSpan _turnOnTimeSpan;
|
||||||
|
private TimeSpan _turnOffTimeSpan;
|
||||||
|
|
||||||
|
public bool IsOn;
|
||||||
|
|
||||||
|
[SerializeField] private SimpleTime _turnOnTime;
|
||||||
|
[SerializeField] private SimpleTime _turnOffTime;
|
||||||
|
|
||||||
|
public SimpleTime TurnOnTime
|
||||||
|
{
|
||||||
|
get => _turnOnTime;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_turnOnTime = value;
|
||||||
|
_turnOnTimeSpan = _turnOnTime.ToTimeSpan();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleTime TurnOffTime
|
||||||
|
{
|
||||||
|
get => _turnOffTime;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_turnOffTime = value;
|
||||||
|
_turnOffTimeSpan = _turnOffTime.ToTimeSpan();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
UpdateOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
UpdateOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateOn()
|
||||||
|
{
|
||||||
|
if (_turnOnTimeSpan < _turnOffTimeSpan)
|
||||||
|
{
|
||||||
|
// beide Zeiten am selben Tag
|
||||||
|
|
||||||
|
bool wasOn = IsOn;
|
||||||
|
|
||||||
|
IsOn = TimeManager.Instance.TimeOfDay.IsBetween(_turnOnTimeSpan, _turnOffTimeSpan);
|
||||||
|
|
||||||
|
if (IsOn != wasOn)
|
||||||
|
{
|
||||||
|
UpdateChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Zeiten über Mitternacht
|
||||||
|
|
||||||
|
bool wasOn = IsOn;
|
||||||
|
|
||||||
|
IsOn = !TimeManager.Instance.TimeOfDay.IsBetween(_turnOffTimeSpan, _turnOnTimeSpan);
|
||||||
|
|
||||||
|
if (IsOn != wasOn)
|
||||||
|
{
|
||||||
|
UpdateChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateChildren()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < transform.childCount; i++)
|
||||||
|
{
|
||||||
|
transform.GetChild(i).gameObject.SetActive(IsOn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnBeforeSerialize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnAfterDeserialize()
|
||||||
|
{
|
||||||
|
_turnOnTimeSpan = _turnOnTime.ToTimeSpan();
|
||||||
|
_turnOffTimeSpan = _turnOffTime.ToTimeSpan();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1627adb53b4429346a7b0a984867d9d2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue