44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using TinyGoose.Tremble;
|
|
using UnityEngine;
|
|
|
|
namespace Code.Game.OfficeGame.Location
|
|
{
|
|
public class LocationSegmentPreProcessor : MapProcessorBase
|
|
{
|
|
// Seems safe to be inaccurate
|
|
private LocationSegment _locationSegment;
|
|
public override void ProcessWorldSpawnProperties(MapBsp mapBsp, BspEntity entity, GameObject rootGameObject)
|
|
{
|
|
_locationSegment = rootGameObject.GetComponentInChildren<LocationSegment>();
|
|
|
|
Debug.Log("ProcessWorldSpawnProperties " + entity.GetString("classname"));
|
|
|
|
foreach (var e in mapBsp.Entities)
|
|
{
|
|
Debug.Log("Entity " + e.GetClassname());
|
|
}
|
|
}
|
|
|
|
public override void ProcessPointEntity(MapBsp mapBsp, BspEntity entity, GameObject point)
|
|
{
|
|
if (entity.GetClassname() != "Utility_LocationTransitionPoint") return;
|
|
|
|
var transitionPoint = point.GetComponent<LocationTransitionPoint>();
|
|
transitionPoint.selfLocationID = _locationSegment.locationID;
|
|
|
|
_locationSegment.transitionPoints.Add(transitionPoint);
|
|
}
|
|
|
|
public override void ProcessBrushEntity(MapBsp mapBsp, BspEntity entity, GameObject brush)
|
|
{
|
|
if (entity.GetClassname() != "func_LocationSegmentTrigger") return;
|
|
|
|
var locationSegmentTrigger = brush.GetComponent<LocationSegmentTrigger>();
|
|
locationSegmentTrigger.segment = _locationSegment;
|
|
|
|
_locationSegment.triggers.Add(locationSegmentTrigger);
|
|
|
|
Debug.Log("Segment set for " + locationSegmentTrigger.name + " segment is " + _locationSegment.locationID);
|
|
}
|
|
}
|
|
} |