private void ShiftReversePerformed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     dynamics.ShiftReverse();
 }
Example #2
0
        public override void OnBridgeSetup(IBridge bridge)
        {
            bridge.AddReader <VehicleStateData>(Topic, data =>
            {
                if (data != null)
                {
                    if (StateData.Blinker != data.Blinker)
                    {
                        if (data.Blinker == 0)
                        {
                            if (Actions.LeftTurnSignal)
                            {
                                Actions.LeftTurnSignal = false;
                            }
                            if (Actions.RightTurnSignal)
                            {
                                Actions.RightTurnSignal = false;
                            }
                            if (Actions.HazardLights)
                            {
                                Actions.HazardLights = false;
                            }
                        }
                        else if (data.Blinker == 1)
                        {
                            Actions.LeftTurnSignal = true;
                        }
                        else if (data.Blinker == 2)
                        {
                            Actions.RightTurnSignal = true;
                        }
                        else if (data.Blinker == 3)
                        {
                            Actions.HazardLights = true;
                        }
                    }
                    if (StateData.HeadLight != data.HeadLight)
                    {
                        if (data.HeadLight == 0)
                        {
                            Actions.CurrentHeadLightState = VehicleActions.HeadLightState.OFF;
                        }
                        else if (data.HeadLight == 1)
                        {
                            Actions.CurrentHeadLightState = VehicleActions.HeadLightState.LOW;
                        }
                        else if (data.HeadLight == 2)
                        {
                            Actions.CurrentHeadLightState = VehicleActions.HeadLightState.HIGH;
                        }
                    }
                    if (StateData.Gear != data.Gear)
                    {
                        if (data.Gear == 1)
                        {
                            Dynamics.ShiftReverse();
                        }
                        else if (data.Gear == 0)
                        {
                            Dynamics.ShiftFirstGear();
                        }
                    }
                    if (StateData.HandBrake != data.HandBrake)
                    {
                        if (data.HandBrake == true)
                        {
                            Dynamics.SetHandBrake(true);
                        }
                        else
                        {
                            Dynamics.SetHandBrake(false);
                        }
                    }

                    StateData = data;
                }
            });
        }