time should be calculated in the correct handler
This commit is contained in:
@@ -139,11 +139,7 @@ namespace Nox.Game {
|
||||
|
||||
var calendarSettings = Addressables.LoadAssetAsync<CalendarSettings>("CalendarSettings").WaitForCompletion();
|
||||
var worldClock = new WorldClock(calendarSettings);
|
||||
var totalMinutes = adventureData.currentDay * calendarSettings.MinutesPerDay
|
||||
+ (int)(adventureData.currentTime * calendarSettings.MinutesPerDay);
|
||||
worldClock.AdvanceMinutes(totalMinutes);
|
||||
worldClock.Tick(adventureData.currentTime);
|
||||
timeHandler ??= new TimeHandler(adventureSettings, adventureData, worldClock);
|
||||
timeHandler ??= new TimeHandler(adventureSettings, adventureData, worldClock, calendarSettings);
|
||||
|
||||
zoneSystem ??= new ZoneSystem(mapRef.zonesObjectHolder);
|
||||
encounterHandler = new EncounterHandler(zoneSystem, encounterRegistry, encounterPrefabs, adventureData, questProgress);
|
||||
@@ -169,7 +165,7 @@ namespace Nox.Game {
|
||||
var popupViewPrefab = Addressables.LoadAssetAsync<GameObject>("PopupReferencePrefab").WaitForCompletion().GetComponent<PopupReference>();
|
||||
var guiCanvas = guiReferences.GetComponentInParent<Canvas>().transform;
|
||||
popupSystem = new PopupSystem(popupSettings, popupViewPrefab, guiCanvas);
|
||||
popupSystem.RegisterCategory(PopupCategory.Character, priority: 10);
|
||||
popupSystem.RegisterCategory(PopupCategory.Character, 10);
|
||||
}
|
||||
|
||||
partyGuiView = new PartyGuiView(guiReferences.portraitsContainer, guiReferences.partyMemberSlotPrefab, portraitsHolder, popupSystem);
|
||||
@@ -207,7 +203,7 @@ namespace Nox.Game {
|
||||
activePlayMode = PlayMode.Adventure,
|
||||
activeParty = partyDefinition,
|
||||
partyPosition = partyRef ? SerializableVector3.FromVector3(partyRef.transform.position) : SerializableVector3.Zero,
|
||||
adventureData = this.adventureData,
|
||||
adventureData = adventureData,
|
||||
questLogEntries = questLog?.CreateSnapshot() ?? new List<QuestLogEntry>()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,10 +28,14 @@ namespace Nox.Game {
|
||||
(0.90f, DayPhase.Night)
|
||||
};
|
||||
|
||||
public TimeHandler(AdventureSettings adventureSettings, AdventureData adventureData, WorldClock worldClock) {
|
||||
public TimeHandler(AdventureSettings adventureSettings, AdventureData adventureData, WorldClock worldClock, CalendarSettings calendarSettings) {
|
||||
this.adventureSettings = adventureSettings;
|
||||
this.adventureData = adventureData;
|
||||
this.worldClock = worldClock;
|
||||
// restore time from saved data
|
||||
var totalMinutes = (adventureData.currentDay * calendarSettings.MinutesPerDay)
|
||||
+ (int)(adventureData.currentTime * calendarSettings.MinutesPerDay);
|
||||
worldClock.AdvanceMinutes(totalMinutes);
|
||||
localTime = adventureData.currentTime * adventureSettings.dayLength;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user