Пример #1
0
 public void SwitchObject(ClassRoomObjects obj)
 {
     if (obj.CheckOnWorking() && CheckTurnOffСonditions(obj))
     {
         obj.TurnOff();
     }
     else if (!obj.CheckOnWorking() && CheckTurnOnСonditions(obj))
     {
         obj.TurnOn();
     }
 }
Пример #2
0
 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();
     }
 }
Пример #3
0
 private bool CheckTurnOnСonditions(ClassRoomObjects obj)
 {
     return((obj.GetType() != typeof(MotionSensor) && obj.GetType() != typeof(VotingSystem) && obj.GetType() != typeof(Screen)) || Door.IsWorking);
 }
Пример #4
0
 private bool CheckTurnOffСonditions(ClassRoomObjects obj)
 {
     return(obj.GetType() != typeof(Door) || (!VotingSystem.IsWorking && !MotionSensor.IsWorking && !Screen.IsWorking));
 }
Пример #5
0
 private bool CheckTurnOnСonditions(ClassRoomObjects obj)
 {
     return((obj.GetType() != typeof(Conditioner) && obj.GetType() != typeof(Projector) && obj.GetType() != typeof(Screen)) || Door.IsWorking);
 }
Пример #6
0
 private bool CheckTurnOffСonditions(ClassRoomObjects obj)
 {
     return(obj.GetType() != typeof(Door) || (!Projector.IsWorking && !Conditioner.IsWorking && !Screen.IsWorking));
 }
Пример #7
0
 private bool CheckTurnOnСonditions(ClassRoomObjects obj)
 {
     return(obj.GetType() == typeof(LightSwitcher) && MotionSensor.IsWorking && !LightSensor.IsWorking ||
            obj.GetType() == typeof(Door) ||
            obj.GetType() == typeof(Door));
 }