Wired in the encounters triggering and saving

This commit is contained in:
Sebastian Bularca
2026-05-21 23:49:28 +02:00
parent 27b7aeee46
commit 8aea6f7eb3
9 changed files with 140 additions and 38 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using Jovian.Calendar;
using Jovian.EncounterSystem;
using Jovian.PopupSystem;
@@ -8,18 +9,23 @@ using Nox.Core;
using Nox.Platform;
using Nox.Game.UI;
using Nox.UI;
using System;
using UnityEngine;
using UnityEngine.AddressableAssets;
using ZLinq;
using Object = UnityEngine.Object;
using PlayMode = Nox.Core.PlayMode;
namespace Nox.Game {
[Serializable]
public class AdventureData {
public bool isPartyMoving;
public bool isEncounterActive;
public int currentDay = 0;
public int suppliesAvailable = -1;
public float currentTime = -1f;
public DayPhase currentDayPhase = DayPhase.Morning;
public List<string> completedEncounterIds = new List<string>();
}
public class AdventurePlayMode : IPlayMode {
@@ -115,12 +121,15 @@ namespace Nox.Game {
partyInventoryHandler ??= new PartyInventoryHandler(adventureData, adventureSettings);
partyInventoryHandler.Initialize();
var calendarSettings = Addressables.LoadAssetAsync<CalendarSettings>("CalendarSettings").WaitForCompletion();
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);
timeHandler ??= new TimeHandler(adventureSettings, adventureData, worldClock);
zoneSystem ??= new ZoneSystem(mapRef.zonesObjectHolder);
encounterHandler = new EncounterHandler(zoneSystem, encounterRegistry, encounterPrefabs);
encounterHandler = new EncounterHandler(zoneSystem, encounterRegistry, encounterPrefabs, adventureData);
partyMovementHandler ??= new PartyMovementHandler(
partyRef,
cameraController,