/// <inheritdoc/> public override void Initialize(ScenarioAgent parentAgent) { base.Initialize(parentAgent); ParentAgent.ExtensionAdded += ParentAgentOnExtensionAdded; ParentAgent.ExtensionRemoved += ParentAgentOnExtensionRemoved; var behaviourExtension = ParentAgent.GetExtension <AgentBehaviour>(); if (behaviourExtension != null) { behaviourExtension.BehaviourChanged += ParentAgentOnBehaviourChanged; } }
/// <inheritdoc/> public override void Deinitialize() { ParentAgent.ExtensionAdded -= ParentAgentOnExtensionAdded; ParentAgent.ExtensionRemoved -= ParentAgentOnExtensionRemoved; var behaviourExtension = ParentAgent.GetExtension <AgentBehaviour>(); if (behaviourExtension != null) { behaviourExtension.BehaviourChanged -= ParentAgentOnBehaviourChanged; } for (var i = waypoints.Count - 1; i >= 0; i--) { var waypoint = waypoints[i]; waypoint.RemoveFromMap(); waypoint.Dispose(); } base.Deinitialize(); }