コード例 #1
0
        /// <summary>
        /// Method called when another scenario element has been selected
        /// </summary>
        /// <param name="selectedElement">Scenario element that has been selected</param>
        private void OnSelectedOtherElement(ScenarioElement selectedElement)
        {
            if (agentWaypoints != null)
            {
                agentWaypoints.IsActiveChanged -= AgentWaypointsOnIsActiveChanged;
            }

            selectedAgent = selectedElement as ScenarioAgent;
            //Attach to selected agent events
            if (selectedAgent != null)
            {
                agentWaypoints = selectedAgent.GetExtension <AgentWaypoints>();
                if (agentWaypoints == null)
                {
                    Hide();
                }
                else
                {
                    agentWaypoints.IsActiveChanged += AgentWaypointsOnIsActiveChanged;
                    Show();
                }
            }
            else
            {
                Hide();
            }
        }
コード例 #2
0
        /// <summary>
        /// Method called when another scenario element has been selected
        /// </summary>
        /// <param name="selectedElement">Scenario element that has been selected</param>
        private void OnSelectedOtherElement(ScenarioElement selectedElement)
        {
            if (isAddingWaypoints)
            {
                ScenarioManager.Instance.GetExtension <InputManager>().CancelAddingElements(this);
            }

            //Force input apply on deselect
            if (selectedWaypoint != null)
            {
                SubmitChangedInputs();
            }
            selectedWaypoint       = selectedElement as ScenarioWaypoint;
            selectedAgent          = selectedWaypoint != null ? selectedWaypoint.ParentAgent : null;
            selectedAgentWaypoints = selectedAgent == null ? null : selectedAgent.GetExtension <AgentWaypoints>();
            //Disable waypoints for ego vehicles
            if (selectedAgent == null || selectedAgentWaypoints == null ||
                !selectedAgent.Source.AgentSupportWaypoints(selectedAgent))
            {
                gameObject.SetActive(false);
            }
            else
            {
                gameObject.SetActive(true);
                speedPanel.SetActive(selectedWaypoint != null);
                waitTimePanel.SetActive(selectedWaypoint != null);
                if (selectedWaypoint != null)
                {
                    speedInput.ExternalValueChange(selectedWaypoint.Speed, false);
                    waitTimeInput.text = selectedWaypoint.WaitTime.ToString("F");
                }

                triggerEditPanel.OnSelectedNewTrigger(selectedWaypoint.LinkedTrigger);
                UnityUtilities.LayoutRebuild(transform as RectTransform);
            }
        }