Exemplo n.º 1
0
        void Update()
        {
            if (!controller)
            {
                return;
            }

            if (controller.GetEngineRunning())
            {
                fanAudio.Set(controller.GetFan() ? 1f : 0.0f);
            }
            else
            {
                fanAudio.Set(0.0f);
            }
        }
Exemplo n.º 2
0
        private bool PopulateActionPacket(LocoShunterActionPacket action)
        {
            var flags = ShunterStateFlags.None;

            flags |= _controller.GetEngineRunning() ? ShunterStateFlags.EngineOn : 0;
            flags |= _controller.GetSandersOn() ? ShunterStateFlags.SandOn : 0;
            flags |= _controller.backlight ? ShunterStateFlags.LightOn : 0;
            flags |= _controller.fan ? ShunterStateFlags.FanOn : 0;
            flags |= _controller.headlights.activeSelf ? ShunterStateFlags.HeadlightOn : 0;

            return(SetStateValue(ref action.Flags, flags) |
                   SetStateValue(ref action.TargetThrottle, _controller.targetThrottle) |
                   SetStateValue(ref action.TargetBrake, _controller.targetBrake) |
                   SetStateValue(ref action.TargetIndependentBrake, _controller.targetIndependentBrake) |
                   SetStateValue(ref action.Reverser, _controller.reverser));
        }