public void SwitchObject(ClassRoomObjects obj) { if (obj.CheckOnWorking() && CheckTurnOffСonditions(obj)) { obj.TurnOff(); } else if (!obj.CheckOnWorking() && CheckTurnOnСonditions(obj)) { obj.TurnOn(); } }
public void SwitchObject(ClassRoomObjects obj) { if (obj.IsWorking && CheckTurnOffСonditions(obj)) { obj.TurnOff(); } else if (!obj.IsWorking && CheckTurnOnСonditions(obj)) { Debug.Log(2); obj.TurnOn(); } }
private bool CheckTurnOnСonditions(ClassRoomObjects obj) { return((obj.GetType() != typeof(MotionSensor) && obj.GetType() != typeof(VotingSystem) && obj.GetType() != typeof(Screen)) || Door.IsWorking); }
private bool CheckTurnOffСonditions(ClassRoomObjects obj) { return(obj.GetType() != typeof(Door) || (!VotingSystem.IsWorking && !MotionSensor.IsWorking && !Screen.IsWorking)); }
private bool CheckTurnOnСonditions(ClassRoomObjects obj) { return((obj.GetType() != typeof(Conditioner) && obj.GetType() != typeof(Projector) && obj.GetType() != typeof(Screen)) || Door.IsWorking); }
private bool CheckTurnOffСonditions(ClassRoomObjects obj) { return(obj.GetType() != typeof(Door) || (!Projector.IsWorking && !Conditioner.IsWorking && !Screen.IsWorking)); }
private bool CheckTurnOnСonditions(ClassRoomObjects obj) { return(obj.GetType() == typeof(LightSwitcher) && MotionSensor.IsWorking && !LightSensor.IsWorking || obj.GetType() == typeof(Door) || obj.GetType() == typeof(Door)); }