Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Player"))
     {
         OnRoomEnter?.Invoke(this);
     }
 }
Exemple #2
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag(Tags.Player))
            {
                ClosePrevRoom();

                this.IsActive = true;

                if (this.PrevRoom != null)
                {
                    this.PrevRoom.IsActive = false;
                }

                if (this._respawnPosition != null)
                {
                    _playerData.RespawnPosition = _respawnPosition.position;
                }

                OnRoomEnter?.Invoke(this.RoomType);

                _camera.transform
                .DOMove(_cameraSnap.position, 1.5f)
                .SetEase(Ease.OutQuint)
                .OnStart(() =>
                {
                    OnRoomChangingStart?.Invoke();
                })
                .OnComplete(() =>
                {
                    OnRoomChangeFinish?.Invoke();
                });
            }
        }
 /// <summary>
 /// Checks if Character enters room
 /// </summary>
 protected virtual void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.TryGetComponent(out Room room))
     {
         CurrentRoom = room;
         OnRoomEnter?.Invoke(room);
     }
 }
Exemple #4
0
 public override void Interact(GameObject player)
 {
     Enter(player);
     OnRoomEnter.Invoke();
 }