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