Exemplo n.º 1
0
 /// <summary>
 /// Initializes GUI stuff
 /// </summary>
 protected virtual void LevelGUIStart()
 {
     // set the level name in the GUI
     LevelNameEvent.Trigger(SceneManager.GetActiveScene().name);
     // fade in
     MMFadeOutEvent.Trigger(IntroFadeDuration);
 }
Exemplo n.º 2
0
        /// <summary>
        /// On play we trigger the selected fade event
        /// </summary>
        /// <param name="position"></param>
        /// <param name="feedbacksIntensity"></param>
        protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
        {
            if (Active)
            {
                _position = GetPosition(position);
                _fadeType = FadeType;
                if (!NormalPlayDirection)
                {
                    if (FadeType == FadeTypes.FadeIn)
                    {
                        _fadeType = FadeTypes.FadeOut;
                    }
                    else if (FadeType == FadeTypes.FadeOut)
                    {
                        _fadeType = FadeTypes.FadeIn;
                    }
                }
                switch (_fadeType)
                {
                case FadeTypes.Custom:
                    MMFadeEvent.Trigger(FeedbackDuration, TargetAlpha, Curve, ID, IgnoreTimeScale, _position);
                    break;

                case FadeTypes.FadeIn:
                    MMFadeInEvent.Trigger(FeedbackDuration, Curve, ID, IgnoreTimeScale, _position);
                    break;

                case FadeTypes.FadeOut:
                    MMFadeOutEvent.Trigger(FeedbackDuration, Curve, ID, IgnoreTimeScale, _position);
                    break;
                }
            }
        }
Exemplo n.º 3
0
        protected virtual IEnumerator TeleportEnd()
        {
            if (FadeToBlack)
            {
                if (TeleportCamera)
                {
                    LevelManager.Instance.LevelCameraController.FollowsPlayer = false;
                }
                MMFadeInEvent.Trigger(FadeDuration);
                yield return(new WaitForSeconds(FadeDuration));

                if (TeleportCamera)
                {
                    LevelManager.Instance.LevelCameraController.TeleportCameraToTarget();
                    LevelManager.Instance.LevelCameraController.FollowsPlayer = true;
                }
                MMFadeOutEvent.Trigger(FadeDuration);
            }
            else
            {
                if (TeleportCamera)
                {
                    LevelManager.Instance.LevelCameraController.TeleportCameraToTarget();
                }
            }
        }
Exemplo n.º 4
0
        protected virtual IEnumerator TeleportSequence(GameObject collider)
        {
            BeforeFadeIn(collider);

            if (FadeToBlack)
            {
                MMFadeInEvent.Trigger(FadeDuration, FaderCurve, FaderID, false, collider.transform.position);
                FadeInComplete(collider);
                yield return(new WaitForSeconds(FadeDuration));
            }
            else
            {
                FadeInComplete(collider);
            }


            if (FadeToBlack)
            {
                yield return(new WaitForSeconds(BetweenFadeDuration));
            }

            AfterFadePause(collider);

            if (FadeToBlack)
            {
                MMFadeOutEvent.Trigger(FadeDuration, FaderCurve, FaderID, false, collider.transform.position);
            }

            AfterFadeOut(collider);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Coroutine that kills the player, stops the camera, resets the points.
        /// </summary>
        /// <returns>The player co.</returns>
        protected virtual IEnumerator SoloModeRestart()
        {
            if ((PlayerPrefabs.Count() <= 0) && (SceneCharacters.Count <= 0))
            {
                yield break;
            }

            // if we've setup our game manager to use lives (meaning our max lives is more than zero)
            if (GameManager.Instance.MaximumLives > 0)
            {
                // we lose a life
                GameManager.Instance.LoseLife();
                // if we're out of lives, we check if we have an exit scene, and move there
                if (GameManager.Instance.CurrentLives <= 0)
                {
                    TopDownEngineEvent.Trigger(TopDownEngineEventTypes.GameOver, null);
                    if ((GameManager.Instance.GameOverScene != null) && (GameManager.Instance.GameOverScene != ""))
                    {
                        LoadingSceneManager.LoadScene(GameManager.Instance.GameOverScene);
                    }
                }
            }

            MMCameraEvent.Trigger(MMCameraEventTypes.StopFollowing);

            MMFadeInEvent.Trigger(OutroFadeDuration, FadeCurve, FaderID, true, Players[0].transform.position);
            yield return(new WaitForSeconds(OutroFadeDuration));

            yield return(new WaitForSeconds(RespawnDelay));

            GUIManager.Instance.SetPauseScreen(false);
            GUIManager.Instance.SetDeathScreen(false);
            MMFadeOutEvent.Trigger(OutroFadeDuration, FadeCurve, FaderID, true, Players[0].transform.position);


            MMCameraEvent.Trigger(MMCameraEventTypes.StartFollowing);

            if (CurrentCheckpoint == null)
            {
                CurrentCheckpoint = InitialSpawnPoint;
            }

            if (Players[0] == null)
            {
                InstantiatePlayableCharacters();
            }

            if (CurrentCheckpoint != null)
            {
                CurrentCheckpoint.SpawnPlayer(Players[0]);
            }
            _started = DateTime.UtcNow;

            // we send a new points event for the GameManager to catch (and other classes that may listen to it too)
            TopDownEnginePointEvent.Trigger(PointsMethods.Set, 0);
            TopDownEngineEvent.Trigger(TopDownEngineEventTypes.RespawnComplete, Players[0]);
            yield break;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Describes the events happening after the pause between the fade in and the fade out
        /// </summary>
        protected virtual void AfterDelayBetweenFades(GameObject collider)
        {
            MMCameraEvent.Trigger(MMCameraEventTypes.StartFollowing);

            if (TriggerFade)
            {
                MMFadeOutEvent.Trigger(FadeInDuration, FadeTween, FaderID, false, LevelManager.Instance.Players[0].transform.position);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initialization
 /// </summary>
 protected virtual void Awake()
 {
     GUIManager.Instance.SetHUDActive(false);
     MMFadeOutEvent.Trigger(FadeInDuration, Tween);
     Cursor.visible = true;
     if (AutoSkipDelay > 1f)
     {
         FadeOutDuration = AutoSkipDelay;
         StartCoroutine(LoadFirstLevel());
     }
 }
 /// <summary>
 /// Initializes GUI stuff
 /// </summary>
 protected virtual void LevelGUIStart()
 {
     // set the level name in the GUI
     LevelNameEvent.Trigger(SceneManager.GetActiveScene().name);
     // fade in
     if (Players.Count > 0)
     {
         MMFadeOutEvent.Trigger(IntroFadeDuration, FadeTween, FaderID, false, Players[0].transform.position);
     }
     else
     {
         MMFadeOutEvent.Trigger(IntroFadeDuration, FadeTween, FaderID, false, Vector3.zero);
     }
 }
        /// <summary>
        /// Describes the events happening after the pause between the fade in and the fade out
        /// </summary>
        protected virtual void AfterDelayBetweenFades(Collider2D collider)
        {
            if (CameraMode == CameraModes.TeleportCamera)
            {
                if (LevelManager.Instance.LevelCameraController != null)
                {
                    LevelManager.Instance.LevelCameraController.TeleportCameraToTarget();
                }
                MMCameraEvent.Trigger(MMCameraEventTypes.StartFollowing);
            }

            AfterDelayBetweenFadesFeedback?.PlayFeedbacks();

            if (TriggerFade)
            {
                MMFadeOutEvent.Trigger(FadeInDuration, FadeTween, FaderID, false, LevelManager.Instance.Players[0].transform.position);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// On play we trigger the selected fade event
        /// </summary>
        /// <param name="position"></param>
        /// <param name="attenuation"></param>
        protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
        {
            if (Active)
            {
                _position = GetPosition(position);
                switch (FadeType)
                {
                case FadeTypes.Custom:
                    MMFadeEvent.Trigger(Duration, TargetAlpha, Curve, ID, IgnoreTimeScale, _position);
                    break;

                case FadeTypes.FadeIn:
                    MMFadeInEvent.Trigger(Duration, Curve, ID, IgnoreTimeScale, _position);
                    break;

                case FadeTypes.FadeOut:
                    MMFadeOutEvent.Trigger(Duration, Curve, ID, IgnoreTimeScale, _position);
                    break;
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// On Start we grab our dependencies and initialize spawn
        /// </summary>
        protected virtual void Start()
        {
            BoundsCollider = _collider;
            InstantiatePlayableCharacters();

            if (UseLevelBounds)
            {
                MMCameraEvent.Trigger(MMCameraEventTypes.SetConfiner, null, BoundsCollider);
            }

            if (Players == null || Players.Count == 0)
            {
                return;
            }

            Initialization();

            // we handle the spawn of the character(s)
            if (Players.Count == 1)
            {
                SpawnSingleCharacter();
            }
            else
            {
                SpawnMultipleCharacters();
            }

            CheckpointAssignment();

            // we trigger a fade
            MMFadeOutEvent.Trigger(IntroFadeDuration, FadeCurve, FaderID);

            // we trigger a level start event
            TopDownEngineEvent.Trigger(TopDownEngineEventTypes.LevelStart, null);
            MMGameEvent.Trigger("Load");

            MMCameraEvent.Trigger(MMCameraEventTypes.SetTargetCharacter, Players[0]);
            MMCameraEvent.Trigger(MMCameraEventTypes.StartFollowing);
            MMGameEvent.Trigger("CameraBound");
        }
Exemplo n.º 12
0
    protected override IEnumerator TeleportEnd()
    {
        if (FadeToBlack)
        {
            //if (TeleportCamera)
            //{
            //    LevelManager.Instance.LevelCameraController.FollowsPlayer = false;
            //}
            MMFadeInEvent.Trigger(FadeDuration);
            yield return(new WaitForSeconds(FadeDuration));

            //if (TeleportCamera)
            //{
            //    LevelManager.Instance.LevelCameraController.TeleportCameraToTarget ();
            //    LevelManager.Instance.LevelCameraController.FollowsPlayer = true;

            //}
            MMFadeOutEvent.Trigger(FadeDuration);
        }
        else
        {
            if (TeleportCamera)
            {
                LevelManager.Instance.LevelCameraController.TeleportCameraToTarget();
            }
        }

        foreach (var vCam in virtualCameras.ToList())
        {
            vCam.Priority = 10;
        }
        activeCam.Priority = activeCam.Priority + 10;


        //LevelManager.Instance.GetComponent<FollowPlayer>().SetActiveCamera();
        //LevelManager.Instance.GetComponent<FollowPlayer>().SetActiveCamera();
    }