示例#1
0
 public void SetTurnSignal(TurnSignal t)
 {
     turnSignalRequest  = t;
     turnSinalRequested = true;
     Status.TurnSignal  = t;
     request            = RequestCommand.Command;
 }
示例#2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TurnSignal != 0)
            {
                hash ^= TurnSignal.GetHashCode();
            }
            if (HighBeam != false)
            {
                hash ^= HighBeam.GetHashCode();
            }
            if (LowBeam != false)
            {
                hash ^= LowBeam.GetHashCode();
            }
            if (Horn != false)
            {
                hash ^= Horn.GetHashCode();
            }
            if (EmergencyLight != false)
            {
                hash ^= EmergencyLight.GetHashCode();
            }
            return(hash);
        }
        public void SetTurnSignal(TurnSignal signal)
        {
            if (Settings.TestMode)
            {
                return;
            }

            Services.Dataset.ItemAs <TurnSignal>("turn signal").Add(signal, Services.RelativePose.CurrentTimestamp);
            byte sigValue = ActuationCommandInterface.ACT_SIG_NONE;

            switch (signal)
            {
            case TurnSignal.Off:
                sigValue = ActuationCommandInterface.ACT_SIG_NONE;
                break;

            case TurnSignal.Left:
                sigValue = ActuationCommandInterface.ACT_SIG_LEFT;
                break;

            case TurnSignal.Right:
                sigValue = ActuationCommandInterface.ACT_SIG_RIGHT;
                break;

            case TurnSignal.Hazard:
                sigValue = ActuationCommandInterface.ACT_SIG_HAZARDS;
                break;
            }

            lastTurnSignal = sigValue;
        }
 private VictoryChecker(
     TurnSignal turnSignal,
     VictorySignal victorySignal,
     IGridModel gridModel)
 {
     this.turnSignal    = turnSignal;
     this.victorySignal = victorySignal;
     this.gridModel     = gridModel;
 }
示例#5
0
 public VehicleStatus(float t, GearDirection g, float v, float sa, float th, float b, TurnSignal ts)
 {
     timestamp     = t;
     gearDirection = g;
     velocity      = v;
     steeringAngle = sa;
     throttle      = th;
     braking       = b;
     turnSignal    = ts;
 }
示例#6
0
 private GridController(
     CardController.Pool cardControllerPool,
     IGridModel gridModel,
     LockInteractionSignal lockInteractionSignal,
     UnlockInteractionSignal unlockInteractionSignal,
     DelayedAction.Pool delayedActionPool,
     TurnSignal turnSignal)
 {
     this.cardControllerPool      = cardControllerPool;
     this.gridModel               = gridModel;
     this.openedCards             = new List <CardController> ();
     this.cardControllers         = new List <CardController> ();
     this.lockInteractionSignal   = lockInteractionSignal;
     this.unlockInteractionSignal = unlockInteractionSignal;
     this.delayedActionPool       = delayedActionPool;
     this.turnSignal              = turnSignal;
 }
示例#7
0
    void SetTurnSignal()
    {
        TrafAIMotor trafAIMotor = transform.parent.gameObject.GetComponent <TrafAIMotor>();

        if (trafAIMotor != null)
        {
            if (trafAIMotor.hasNextEntry)
            {                                                                                                              //I am waiting at the intersection
                float dstToTarget = Vector3.Distance(rayCastPos.position, trafAIMotor.nextEntry.waypoints[0]);
                if (dstToTarget <= 10f && trafAIMotor.currentFixedNode != 1)                                               //currentFixedNode condition is used to exclude the first road which is the only exception which I cannot exclude by the angle
                {
                    Vector3 nextRoadWayPoint = trafAIMotor.nextEntry.waypoints[trafAIMotor.nextEntry.waypoints.Count - 1]; //I save the last waypoint of the next road
                    Vector3 heading          = (nextRoadWayPoint - rayCastPos.position).normalized;                        //direction from PlayerCar to the the last waypoint of the next road
                    float   angle            = Vector3.SignedAngle(rayCastPos.forward, heading, Vector3.up);               //angle between heading and direction of PlayerCar
                    //foreach (var s in trafAIMotor.nextEntry.waypoints)
                    //{
                    //    GameObject game = new GameObject("Node");
                    //    game.transform.position = s;
                    //    SphereCollider sphereCol = game.AddComponent<SphereCollider>();
                    //}

                    if (angle < -4f)
                    {
                        turnLeftAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.LEFT;
                    }
                    else if (angle > 4f)
                    {
                        turnRightAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.RIGHT;
                    }
                }
            }
            else if ((!trafAIMotor.hasNextEntry && !trafAIMotor.currentEntry.isIntersection()) && Mathf.Abs(vehicleController.steerInput) <= 0.02f) //With the steerInput condition I assure that the turn signal is set off when steer has more or less angle equal to zero
            {
                if (lastTurnSignal.Equals(TurnSignal.LEFT))
                {
                    turnLeftAnim.SetBool("Turn", false);
                }
                else if (lastTurnSignal.Equals(TurnSignal.RIGHT))
                {
                    turnRightAnim.SetBool("Turn", false);
                }
            }
        }
    }
    void SetTurnSignal()
    {
        TrafAIMotor trafAIMotor = transform.root.gameObject.GetComponent <TrafAIMotor>();

        if (trafAIMotor != null)
        {
            if (trafAIMotor.hasNextEntry && trafAIMotor.nextEntry.identifier != 1088) //this used to exclude the first road which is the only exception which I cannot exclude by the angle
            {                                                                         //I am waiting at the intersection
                float dstToTarget = Vector3.Distance(nose.position, trafAIMotor.nextEntry.waypoints[0]);
                if (dstToTarget <= 20f)
                {
                    Vector3 nextRoadWayPoint = trafAIMotor.nextEntry.waypoints[trafAIMotor.nextEntry.waypoints.Count - 1]; //I save the last waypoint of the next road
                    Vector3 heading          = (nextRoadWayPoint - nose.position).normalized;                              //direction from PlayerCar to the the last waypoint of the next road
                    float   angle            = Vector3.SignedAngle(nose.forward, heading, Vector3.up);                     //angle between heading and direction of PlayerCar

                    if (angle < -4f)
                    {
                        turnLeftAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.LEFT;
                    }
                    else if (angle > 4f)
                    {
                        turnRightAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.RIGHT;
                    }
                }
            }
            else if ((!trafAIMotor.hasNextEntry && !trafAIMotor.currentEntry.isIntersection()) && Mathf.Abs(trafAIMotor.currentTurn) <= 1f) //With the steerInput condition I assure that the turn signal is set off when steer has more or less angle equal to zero
            {
                if (lastTurnSignal.Equals(TurnSignal.LEFT))
                {
                    turnLeftAnim.SetBool("Turn", false);
                }
                else if (lastTurnSignal.Equals(TurnSignal.RIGHT))
                {
                    turnRightAnim.SetBool("Turn", false);
                }
            }
        }
    }
 public void Initialize()
 {
     turnSignal += TurnSignal;
 }
示例#10
0
 void OnTurn(float mult)
 {
     TurnSignal.Dispatch(mult);
 }
 public void SetTurnSignal(TurnSignal signal)
 {
     // don't do anything with this as the moment
 }
示例#12
0
 public void SetTurnSignal(TurnSignal t)
 {
     turnSignalRequest  = t;
     turnSinalRequested = true;
 }
示例#13
0
    void SetTurnSignal()
    {
        TrafAIMotor trafAIMotor = transform.parent.gameObject.GetComponent <TrafAIMotor>();

        if (trafAIMotor != null)
        {
            if (trafAIMotor.hasNextEntry) //this used to exclude the first road which is the only exception which I cannot exclude by the angle
            {                             //I am waiting at the intersection
                float dstToTarget = Vector3.Distance(rayCastPos.position, trafAIMotor.nextEntry.waypoints[0]);
                if (dstToTarget <= 20f)
                {
                    TrafEntry nextRoadWaypoints = trafAIMotor.system.GetEntry(trafAIMotor.fixedPath[trafAIMotor.currentFixedNode].id, trafAIMotor.fixedPath[trafAIMotor.currentFixedNode].subId); //points of the next piece of road
                    Vector3   heading           = (nextRoadWaypoints.waypoints[nextRoadWaypoints.waypoints.Count - 1] - rayCastPos.position).normalized;
                    float     angle             = Vector3.SignedAngle(rayCastPos.forward, heading, Vector3.up);                                                                                   //angle between heading and direction of PlayerCar

                    if (angle < -20f)
                    {
                        if (!hasPlayedON)
                        {
                            turnLeftAudioSource.PlayOneShot(ResourceHandler.instance.audioClips[7]);
                            hasPlayedON = true;
                        }
                        turnLeftAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.LEFT;
                        hasPlayedOFF   = false;
                    }
                    else if (angle > 20f)
                    {
                        if (!hasPlayedON)
                        {
                            turnRightAudioSource.PlayOneShot(ResourceHandler.instance.audioClips[7]);
                            hasPlayedON = true;
                        }
                        turnRightAnim.SetBool("Turn", true);
                        lastTurnSignal = TurnSignal.RIGHT;
                        hasPlayedOFF   = false;
                    }
                }
            }
            else if ((!trafAIMotor.hasNextEntry && !trafAIMotor.currentEntry.isIntersection()) && Mathf.Abs(vehicleController.steerInput) <= 0.02f) //With the steerInput condition I assure that the turn signal is set off when steer has more or less angle equal to zero
            {
                if (lastTurnSignal.Equals(TurnSignal.LEFT))
                {
                    turnLeftAnim.SetBool("Turn", false);
                    hasPlayedON = false;
                    if (!hasPlayedOFF)
                    {
                        turnLeftAudioSource.PlayOneShot(ResourceHandler.instance.audioClips[6]);
                        hasPlayedOFF = true;
                    }
                }

                else if (lastTurnSignal.Equals(TurnSignal.RIGHT))
                {
                    turnRightAnim.SetBool("Turn", false);
                    hasPlayedON = false;
                    if (!hasPlayedOFF)
                    {
                        turnRightAudioSource.PlayOneShot(ResourceHandler.instance.audioClips[6]);
                        hasPlayedOFF = true;
                    }
                }
            }
        }
    }
        public void SetTurnSignal(TurnSignal signal)
        {
            if (Settings.TestMode)
                return;

            Services.Dataset.ItemAs<TurnSignal>("turn signal").Add(signal, Services.RelativePose.CurrentTimestamp);
            byte sigValue = ActuationCommandInterface.ACT_SIG_NONE;
            switch (signal) {
                case TurnSignal.Off:
                    sigValue = ActuationCommandInterface.ACT_SIG_NONE;
                    break;

                case TurnSignal.Left:
                    sigValue = ActuationCommandInterface.ACT_SIG_LEFT;
                    break;

                case TurnSignal.Right:
                    sigValue = ActuationCommandInterface.ACT_SIG_RIGHT;
                    break;

                case TurnSignal.Hazard:
                    sigValue = ActuationCommandInterface.ACT_SIG_HAZARDS;
                    break;
            }

            lastTurnSignal = sigValue;
        }
 public TurnSignalDecorator(TurnSignal signal)
 {
     this.signal = signal;
 }
 public void SetTurnSignal(TurnSignal signal)
 {
     // don't do anything with this as the moment
 }