Esempio n. 1
0
 public void MergeFrom(DeciderRuleBasedStopConfig other)
 {
     if (other == null)
     {
         return;
     }
     if (other.crosswalk_ != null)
     {
         if (crosswalk_ == null)
         {
             crosswalk_ = new global::Apollo.Planning.RuleCrosswalkConfig();
         }
         Crosswalk.MergeFrom(other.Crosswalk);
     }
     if (other.stopSign_ != null)
     {
         if (stopSign_ == null)
         {
             stopSign_ = new global::Apollo.Planning.RuleStopSignConfig();
         }
         StopSign.MergeFrom(other.StopSign);
     }
     if (other.trafficLight_ != null)
     {
         if (trafficLight_ == null)
         {
             trafficLight_ = new global::Apollo.Planning.RuleTrafficLightConfig();
         }
         TrafficLight.MergeFrom(other.TrafficLight);
     }
 }
Esempio n. 2
0
    public void CheckAllInfractions(Crosswalk _crosswalk)
    {
        if (!isAlreadyReported)
        {
            isAlreadyReported = true;
            if (_crosswalk != null)
            {
                ActivePedestrianCount = _crosswalk.GetNumberOfCrossingPedestrians;
                DebugController.LogWarningMessage("Active Pedestrian Count: " + ActivePedestrianCount);
                DebugController.LogErrorMessage("Checking infractions");
                for (int i = 0; i < infractionsArray.Length; i++)
                {
                    if (ActivePedestrianCount > 0)
                    {
                        infractionsArray[i].AreThereCrossingPedestrians = true;
                    }
                    else
                    {
                        infractionsArray[i].AreThereCrossingPedestrians = false;
                    }

                    Debug.LogWarning("1) CheckAllInfractions Running (Evaluando el array de infracciones)");
                    infractionsArray[i].evaluatedObject = controlledObject;
                    infractionsArray[i].CheckForRuleViolation();
                    if (infractionsArray[i].CheckForRuleViolation() == true)
                    {
                        ScoreManager.instance.AddInfraction();
                    }
                }
            }
            else
            {
                for (int i = 0; i < infractionsArray.Length; i++)
                {
                    Debug.LogError("ESTOY EVALUANDO UNA INFRACCION SIN TENER CROSSWALK CERQUITA");
                    infractionsArray[i].AreThereCrossingPedestrians = false;
                    Debug.LogWarning("1) CheckAllInfractions Running (Evaluando el array de infracciones)");
                    infractionsArray[i].evaluatedObject = controlledObject;
                    infractionsArray[i].CheckForRuleViolation();
                    if (infractionsArray[i].CheckForRuleViolation() == true)
                    {
                        ScoreManager.instance.AddInfraction();
                    }
                }
            }
        }
        else
        {
            Debug.LogError("YA ESTA REPORTADO");
        }
    }
Esempio n. 3
0
        public new void Render(RenderManager.CameraInfo cameraInfo, Color?color = null, float?width = null, bool?alphaBlend = null, bool?cut = null)
        {
            Crosswalk.Render(cameraInfo, Colors.Hover);
            CrosswalkLine.Render(cameraInfo, color, width, alphaBlend, cut);

            switch (Border)
            {
            case BorderPosition.Left:
                Crosswalk.LeftBorderTrajectory.Render(cameraInfo, color, width, alphaBlend, cut);
                break;

            case BorderPosition.Right:
                Crosswalk.RightBorderTrajectory.Render(cameraInfo, color, width, alphaBlend, cut);
                break;
            }
        }
Esempio n. 4
0
 public override void OnCrossWalkEntered(ICrossable _crossWalk) 
 {
     DebugController.LogMessage("Player entered crosswalk");
     // Si hay peatones cruzando sacar lo de las infracciones
     Crosswalk cross = ((Crosswalk)_crossWalk);
     if (cross.GetNumberOfCrossingPedestrians > 0)
     {
         if (!cross.CanCrossIfPathIsFree(this))
         {
             ScoreManager.instance.AddInfraction();
             CanvasManager._instance.ActivateCheckOrCross(false);
             CanvasManager._instance.GenerateFeedback("CrossWithPedestrian");
         }
     }
     OnStartedCrossing(_crossWalk);
     _crossWalk.OnStartedCrossing(this);
 }
Esempio n. 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (crosswalk_ != null)
            {
                hash ^= Crosswalk.GetHashCode();
            }
            if (stopSign_ != null)
            {
                hash ^= StopSign.GetHashCode();
            }
            if (trafficLight_ != null)
            {
                hash ^= TrafficLight.GetHashCode();
            }
            return(hash);
        }
Esempio n. 6
0
        public new void Render(OverlayData data)
        {
            Crosswalk.Render(new OverlayData(data.CameraInfo)
            {
                Color = Colors.Hover
            });
            CrosswalkLine.Render(data);

            switch (Border)
            {
            case BorderPosition.Left:
                Crosswalk.LeftBorderTrajectory.Render(data);
                break;

            case BorderPosition.Right:
                Crosswalk.RightBorderTrajectory.Render(data);
                break;
            }
        }