using System.Collections; using System.Collections.Generic; using UnityEngine; using SiegeSong; namespace SiegeSong { public class LoadingCellManager : MonoBehaviour { public RuntimeManager RuntimeManager; public InstanceManager InstanceManager; public Transform PlayerTracker; public string CurrentArea; public string CurrentLocale; public string CurrentRegion; void Start() { } void Update() { var hits = Physics.RaycastAll(PlayerTracker.position, -transform.up, 100.0F); foreach (var hit in hits) { var loadingCell = hit.transform.gameObject.GetComponent(); if (loadingCell != null && loadingCell.LocationName != CurrentArea) { CurrentArea = loadingCell.LocationName; RuntimeManager.NotificationManager.Notify($"Now Entering {loadingCell.LocationName}"); foreach(var terrain in RuntimeManager.SaveFileLoader.MainPlugins[0].Terrains) { foreach(var loadingCells in terrain.LoadingCells) { foreach (var worldObjectPlacement in loadingCells.WorldObjectPlacements) { InstanceManager.InstantiateWorldObject(worldObjectPlacement); } } } } } } } }