Exemplo n.º 1
0
    /* Make this object a subordinate object. Make the switch boss around the behavior of this thing*/

    /// <summary>
    /// This method is called from the connected Conveyor Switch when its state changes.
    /// It will update the belt current state and its sprite.
    /// </summary>
    /// <param name="switchState"></param>
    public void UpdateStatus(ConveyorBeltSwitch.State switchState)
    {
        switch (switchState)
        {
        case ConveyorBeltSwitch.State.Off:
            CurrentStatus = ConveyorStatus.Off;
            break;

        case ConveyorBeltSwitch.State.Forward:
            CurrentStatus = ConveyorStatus.Forward;
            break;

        case ConveyorBeltSwitch.State.Backward:
            CurrentStatus = ConveyorStatus.Backward;
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(switchState), switchState, null);
        }

        ChangeAnimation();
    }
Exemplo n.º 2
0
    public void UpdateStatus(ConveyorBeltSwitch.State switchState)
    {
        switch (switchState)
        {
        case ConveyorBeltSwitch.State.Off:
            SyncStatus(ConveyorStatus.Off);
            break;

        case ConveyorBeltSwitch.State.Forward:
            SyncStatus(ConveyorStatus.Forward);
            break;

        case ConveyorBeltSwitch.State.Backward:
            SyncStatus(ConveyorStatus.Backward);
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(switchState), switchState, null);
        }

        GetPositionOffset();
        RefreshSprites();
    }