This commit is contained in:
Mister_Nebula 2022-05-17 08:00:31 +01:00
parent f2f0266aee
commit f8f9f26a1c

View File

@ -179,10 +179,26 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
AttachedObject._controller = AttachedObject.GetComponent<GhostController>();
AttachedObject._sensors = AttachedObject.GetComponent<GhostSensors>();
_data = new();
AttachedObject._controller.OnArriveAtPosition -= AttachedObject.OnArriveAtPosition;
AttachedObject._controller.OnArriveAtPosition += OnArriveAtPosition;
AttachedObject._controller.OnTraversePathNode -= AttachedObject.OnTraversePathNode;
AttachedObject._controller.OnTraversePathNode += OnTraversePathNode;
AttachedObject._controller.OnFaceNode -= AttachedObject.OnFaceNode;
AttachedObject._controller.OnFaceNode += OnFaceNode;
AttachedObject._controller.OnFinishFaceNodeList -= AttachedObject.OnFinishFaceNodeList;
AttachedObject._controller.OnFinishFaceNodeList += OnFinishFaceNodeList;
if (AttachedObject._data != null)
{
_data.threatAwareness = AttachedObject._data.threatAwareness;
}
GlobalMessenger.AddListener("EnterDreamWorld", new Callback(OnEnterDreamWorld));
GlobalMessenger.AddListener("ExitDreamWorld", new Callback(OnExitDreamWorld));
}
public void Start()
@ -212,13 +228,13 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
public void OnDestroy()
{
AttachedObject._sensors.RemoveEventListeners();
AttachedObject._controller.OnArriveAtPosition -= AttachedObject.OnArriveAtPosition;
AttachedObject._controller.OnTraversePathNode -= AttachedObject.OnTraversePathNode;
AttachedObject._controller.OnFaceNode -= AttachedObject.OnFaceNode;
AttachedObject._controller.OnFinishFaceNodeList -= AttachedObject.OnFinishFaceNodeList;
AttachedObject._effects.OnCallForHelp -= AttachedObject.OnCallForHelp;
GlobalMessenger.RemoveListener("EnterDreamWorld", new Callback(AttachedObject.OnEnterDreamWorld));
GlobalMessenger.RemoveListener("ExitDreamWorld", new Callback(AttachedObject.OnExitDreamWorld));
AttachedObject._controller.OnArriveAtPosition -= OnArriveAtPosition;
AttachedObject._controller.OnTraversePathNode -= OnTraversePathNode;
AttachedObject._controller.OnFaceNode -= OnFaceNode;
AttachedObject._controller.OnFinishFaceNodeList -= OnFinishFaceNodeList;
AttachedObject._effects.OnCallForHelp -= OnCallForHelp;
GlobalMessenger.RemoveListener("EnterDreamWorld", new Callback(OnEnterDreamWorld));
GlobalMessenger.RemoveListener("ExitDreamWorld", new Callback(OnExitDreamWorld));
}
public void TabulaRasa()