You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB
C#

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<LoadingCell>();
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);
}
}
}
}
}
}
}
}