/// <summary>
        /// Describes the events happening once the initial fade in is complete
        /// </summary>
        protected virtual void AfterFadeOut(Collider2D collider)
        {
            if (AddToDestinationIgnoreList)
            {
                Destination.AddToIgnoreList(collider.transform);
            }

            if (CameraMode == CameraModes.CinemachinePriority)
            {
                MMCameraEvent.Trigger(MMCameraEventTypes.ResetPriorities);
                MMCinemachineBrainEvent.Trigger(MMCinemachineBrainEventTypes.ChangeBlendDuration, DelayBetweenFades);
            }

            if (CurrentRoom != null)
            {
                CurrentRoom.PlayerExitsRoom();
            }

            if (TargetRoom != null)
            {
                TargetRoom.PlayerEntersRoom();
                TargetRoom.VirtualCamera.Priority = 10;
                MMSpriteMaskEvent.Trigger(MoveMaskMethod, (Vector2)TargetRoom.RoomCollider.bounds.center + TargetRoom.RoomCollider.offset, TargetRoom.RoomCollider.bounds.size, MoveMaskDuration, MoveMaskCurve);
            }

            AfterFadeOutFeedback?.PlayFeedbacks();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Looks for the level start position and if it's inside the room, makes this room the current one
        /// </summary>
        protected virtual void HandleLevelStartDetection()
        {
            if (!_initialized)
            {
                Initialization();
            }

            if (AutoDetectFirstRoomOnStart)
            {
                if (LevelManager.Instance != null)
                {
                    if (RoomBounds.Contains(LevelManager.Instance.Players[0].transform.position))
                    {
                        MMCameraEvent.Trigger(MMCameraEventTypes.ResetPriorities);
                        MMCinemachineBrainEvent.Trigger(MMCinemachineBrainEventTypes.ChangeBlendDuration, 0f);

                        MMSpriteMaskEvent.Trigger(MMSpriteMaskEvent.MMSpriteMaskEventTypes.MoveToNewPosition,
                                                  RoomColliderCenter,
                                                  RoomColliderSize,
                                                  0f, MMTween.MMTweenCurve.LinearTween);

                        PlayerEntersRoom();
                        VirtualCamera.Priority = 10;
                        VirtualCamera.enabled  = true;
                    }
                    else
                    {
                        VirtualCamera.Priority = 0;
                        VirtualCamera.enabled  = false;
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Describes the events happening once the initial fade in is complete
        /// </summary>
        protected virtual void AfterFadeOut(GameObject collider)
        {
            TeleportCollider(collider);

            if (AddToDestinationIgnoreList)
            {
                Destination.AddToIgnoreList(collider.transform);
            }

            if (CameraMode == CameraModes.CinemachinePriority)
            {
                MMCameraEvent.Trigger(MMCameraEventTypes.ResetPriorities);
                MMCinemachineBrainEvent.Trigger(MMCinemachineBrainEventTypes.ChangeBlendDuration, DelayBetweenFades);
            }

            if (CurrentRoom != null)
            {
                CurrentRoom.PlayerExitsRoom();
            }

            if (TargetRoom != null)
            {
                TargetRoom.PlayerEntersRoom();
                TargetRoom.VirtualCamera.Priority = 10;
                MMSpriteMaskEvent.Trigger(MoveMaskMethod, (Vector2)TargetRoom.RoomColliderCenter, TargetRoom.RoomColliderSize, MoveMaskDuration, MoveMaskCurve);
            }
        }