Exemplo n.º 1
0
 public void InputBinary(bool binary, InputEffect inputEffect)
 {
     if (binary)
     {
         TurnOn(inputEffect);
     }
     else
     {
         TurnOff(inputEffect);
     }
 }
Exemplo n.º 2
0
        public void TurnOff(InputEffect inputEffect)
        {
            var isImmediate = inputEffect == InputEffect.Immediate;

            if (isLocked)
            {
                return;
            }

            if (isImmediate || turnOffTimer == null)
            {
                stateMachine.State = StateType.Off;
                return;
            }
            stateMachine.State = StateType.TurnOff;
            turnOffTimer.SetProgress(1.0f - ValveState);
        }
Exemplo n.º 3
0
        public void Switch(InputEffect inputEffect)
        {
            if (isLocked)
            {
                return;
            }

            switch (stateMachine.State)
            {
            case StateType.Off:
            case StateType.TurnOff:
                TurnOn(inputEffect);
                break;

            case StateType.On:
            case StateType.TurnOn:
                TurnOff(inputEffect);
                break;
            }
        }