예제 #1
0
        /// <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;
            }
        }
예제 #2
0
        /// <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();
        }