public void Switch(LeverGateType type) { foreach (var gate in gates) { if (gate.LeverGateType == type) { if (!gate.CanSwitch()) { return; } } } foreach (var lever in levers) { if (lever.LeverGateType == type) { lever.SwitchState(); } } foreach (var gate in gates) { if (gate.LeverGateType == type) { gate.SwitchState(); } } }
static Color GetColorOf(LeverGateType type) { switch (type) { case LeverGateType.Type1: return(new Color(1, 0.85f, 0.85f)); case LeverGateType.Type2: return(new Color(0.85f, 1, 0.85f));; case LeverGateType.Type3: return(new Color(0.85f, 0.85f, 1));; default: return(Color.white); } }
public static Color GetColorOf(LeverGateType type) { switch (type) { case LeverGateType.Type1: return(Color1); case LeverGateType.Type2: return(Color2); case LeverGateType.Type3: return(Color3); default: return(Color.white); } }