/// <inheritdoc /> public override void GetState(ShunterLocoState state) { _base.GetState(state); state.LocoType = "shunter"; state.Sander = _inner.GetSandersOn() ? 1 : 0; state.SanderFlow = _inner.GetSandersFlow() / _sim.sandFlow.max; state.EngineTemp = _inner.GetEngineTemp(); state.EngineOn = _inner.EngineOn; }
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)); }