Beispiel #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Doorway doorway = other.GetComponent <Doorway>();

        if (doorway != null)
        {
            doorway.OnPlayerEntered.Invoke();
            OnEnteredDoor.Invoke(doorway.LevelToGoTo);
        }
    }
Beispiel #2
0
 public bool OnDoorClose()  // Close door
 {
     // Door closed or locked = kan ikke close
     if (!_doorOpen || !_doorUnlocked)
     {
         return(_doorOpen);
     }
     _doorOpen       = false;
     State.DoorState = false;
     DoorEvent?.Invoke(this, State);
     return(_doorOpen);
 }
Beispiel #3
0
 //CLose the door
 public void DoorClosed()
 {
     if (!DoorState || !LockState)
     {
         return; // Returns if the door is closed or locked
     }
     //Sets new states
     doorEventState.DoorState = false;
     DoorState = false;
     //Event invoke
     DoorEvent?.Invoke(this, doorEventState);
 }
Beispiel #4
0
 //Open the door
 public void DoorOpen()
 {
     if (DoorState || !LockState)
     {
         return; // Returns if the door is open or locked
     }
     //Sets new states
     doorEventState.DoorState = true;
     DoorState = true;
     //Event invoke
     DoorEvent?.Invoke(this, doorEventState);
 }
Beispiel #5
0
 public void OnDoorClose()
 {
     if (!Open)
     {
         Console.WriteLine("Man kan ikke lukke en lukket dør(Door Simulator)");
         return;
     }
     Open = false;
     DoorEvent?.Invoke(this, new DoorEventArgs()
     {
         IsDoorOpen = false
     });
 }
Beispiel #6
0
 public bool OnDoorOpen() // Åben door
 {
     // Already Open or locked = kan ikke doorOpen
     if (_doorOpen || !_doorUnlocked)
     {
         return(_doorOpen);
     }
     _doorOpen       = true;
     State.DoorState = true;
     //Event til Station control
     DoorEvent?.Invoke(this, State);
     return(_doorOpen);
 }
Beispiel #7
0
 // Activates when the User opens the door
 public void DoorOpened()
 {
     //If the Door is already open or locked return
     if (DoorState || DoorLocked)
     {
         return;
     }
     // Sets state
     State.DoorState = true;
     DoorState       = true;
     // Invoke Event
     DoorEvent?.Invoke(this, State);
 }
Beispiel #8
0
 // Activates when the User closes the door
 public void DoorClosed()
 {
     // If the door is already closed return
     if (!DoorState || DoorLocked)
     {
         return;
     }
     // Sets state
     State.DoorState = false;
     DoorState       = false;
     // Invokes event
     DoorEvent?.Invoke(this, State);
 }
Beispiel #9
0
 public void OnDoorOpen()
 {
     if (Open)
     {
         Console.WriteLine("Man kan ikke åbne en åben dør");
     }
     else
     {
         if (Islocked)
         {
             Console.WriteLine("Døren er låst. Du kan ikke åbne den (Door Simulator)");
             return;
         }
         Open = true;
         // Console.WriteLine("Døren er åben.");
         DoorEvent?.Invoke(this, new DoorEventArgs()
         {
             IsDoorOpen = true
         });
     }
 }
Beispiel #10
0
 private void OpenDoor()
 {
     doorOpened.Invoke(this);
     StartCoroutine(Open());
 }
Beispiel #11
0
 protected virtual void OnDoorChanged(DoorEventArgs e)
 {
     DoorEvent?.Invoke(this, e);
 }
Beispiel #12
0
 private void OnDoorClose(DoorEventArgs e)
 {
     DoorEvent?.Invoke(this, e);
 }
Beispiel #13
0
 private void OnDoorOpen(DoorEventArgs e)
 {
     DoorEvent?.Invoke(this, e);
 }
Beispiel #14
0
 protected void Close()
 {
     IsOpen = false;
     DoorEvent?.Invoke(this, new DoorMovmentEventArgs(IsOpen));
 }
Beispiel #15
0
 protected void Open()
 {
     IsOpen = true;
     DoorEvent?.Invoke(this, new DoorMovmentEventArgs(IsOpen));
 }