/// <inheritdoc/>
 public override void Initialize(ScenarioAgent parentAgent)
 {
     base.Initialize(parentAgent);
     if (parentAgent.Variant is EgoAgentVariant egoAgentVariant && egoAgentVariant.SensorsConfigurations.Count > 0)
     {
         ChangeSensorsConfigurationId(egoAgentVariant.SensorsConfigurations[0].Id, false);
     }
     ParentAgent.VariantChanged += ParentAgentOnVariantChanged;
 }
        /// <inheritdoc/>
        public override void CopyProperties(ScenarioAgent agent)
        {
            var origin = agent.GetExtension <AgentSensorsConfiguration>();

            if (origin == null)
            {
                return;
            }
            SensorsConfigurationId = origin.SensorsConfigurationId;
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public override void CopyProperties(ScenarioAgent agent)
        {
            var origin = agent.GetExtension <AgentBehaviour>();

            if (origin == null)
            {
                return;
            }
            Behaviour           = origin.Behaviour;
            BehaviourParameters = JSON.Parse(origin.BehaviourParameters.ToString()) as JSONObject;
        }
Exemplo n.º 4
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;
            }
        }
        /// <inheritdoc/>
        public override void CopyProperties(ScenarioAgent agent)
        {
            var origin = agent.GetExtension <AgentDestinationPoint>();

            if (origin == null)
            {
                return;
            }
            var destinationPoint = ParentAgent.GetComponentInChildren <ScenarioDestinationPoint>(true);

            if (destinationPoint != null)
            {
                destinationPoint.AttachToAgent(ParentAgent, false);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Attach this destination point to the agent
        /// </summary>
        /// <param name="agent">Scenario agent to which destination point will be attached</param>
        /// <param name="initializeTransform">Should this attach initialize the transform</param>
        public void AttachToAgent(ScenarioAgent agent, bool initializeTransform)
        {
            ParentAgent = agent;
            var extension = agent.GetExtension <AgentDestinationPoint>();

            extension.DestinationPoint = this;
            if (!initializeTransform)
            {
                return;
            }
            transform.SetParent(agent.transform);
            var forward = agent.TransformToMove.forward;

            TransformToMove.localPosition   = forward * InitialOffset;
            TransformToRotate.localRotation = Quaternion.LookRotation(forward);
            Refresh();
        }
Exemplo n.º 7
0
        /// <inheritdoc/>
        public override void CopyProperties(ScenarioAgent agent)
        {
            var origin = agent.GetExtension <AgentWaypoints>();

            if (origin == null)
            {
                return;
            }

            PathRenderer.positionCount = 0;
            for (var i = 0; i < ParentAgent.transform.childCount; i++)
            {
                var child = ParentAgent.transform.GetChild(i);
                if (child.name == WaypointsObjectName)
                {
                    waypointsParent = child;
                    for (var j = 0; j < waypointsParent.childCount; j++)
                    {
                        var waypoint = waypointsParent.GetChild(j).GetComponent <ScenarioWaypoint>();
                        AddWaypoint(waypoint, waypoint.IndexInAgent);
                    }
                }
            }
        }
Exemplo n.º 8
0
 /// <inheritdoc/>
 public override void Initialize(ScenarioAgent parentAgent)
 {
     base.Initialize(parentAgent);
     ChangeBehaviour(nameof(NPCWaypointBehaviour), false);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Method called after this element is instantiated using copied agent
 /// </summary>
 /// <param name="agent">Origin agent from which copy was created</param>
 public abstract void CopyProperties(ScenarioAgent agent);
Exemplo n.º 10
0
 /// <summary>
 /// Deinitialization method
 /// </summary>
 public virtual void Deinitialize()
 {
     ParentAgent = null;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initialization method
 /// </summary>
 /// <param name="parentAgent">Scenario agent that this object extends</param>
 public virtual void Initialize(ScenarioAgent parentAgent)
 {
     ParentAgent = parentAgent;
 }