public void SetState(ConveyorSwitchComponent conveyorSwitch) { var state = conveyorSwitch.State; if (state == ConveyorState.Loose) { if (_switches.Count > 0) { return; } state = ConveyorState.Off; } State = state; foreach (var conveyor in Conveyors) { conveyor.Sync(this); } foreach (var connectedSwitch in _switches) { connectedSwitch.Sync(this); } }
public void AddSwitch(ConveyorSwitchComponent conveyorSwitch) { _switches.Add(conveyorSwitch); if (_switches.Count == 1) { SetState(conveyorSwitch); } conveyorSwitch.Sync(this); }
public void RemoveSwitch(ConveyorSwitchComponent conveyorSwitch) { _switches.Remove(conveyorSwitch); }