Пример #1
0
 public void AddKey()
 {
     _count++;
     OnKeyCountChanged?.Invoke(this, new OnKeyCountChangedEventArgs {
         count = _count
     });
 }
Пример #2
0
 public void Activate(Transform player)
 {
     if (_count > 0)
     {
         Collider2D[] hits = Physics2D.OverlapCircleAll(player.position, 1);
         foreach (var hit in hits)
         {
             if (hit.CompareTag("Door"))
             {
                 Debug.Log("XUI");
                 Door door = hit.GetComponent <Door>();
                 door.Open();
                 break;
             }
         }
         _count--;
         OnKeyCountChanged?.Invoke(this, new OnKeyCountChangedEventArgs {
             count = _count
         });
     }
 }