private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer("Player")) { OnRoomEnter?.Invoke(this); } }
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); } }
public override void Interact(GameObject player) { Enter(player); OnRoomEnter.Invoke(); }