Beispiel #1
0
        // end the level
        public void EndLevel()
        {
            if (_player != null)
            {
                // disable the player controls
                ThirdPersonUserControl thirdPersonControl =
                    _player.GetComponent <ThirdPersonUserControl>();

                if (thirdPersonControl != null)
                {
                    thirdPersonControl.enabled = false;
                }

                // remove any existing motion on the player
                Rigidbody rbody = _player.GetComponent <Rigidbody>();
                if (rbody != null)
                {
                    rbody.velocity = Vector3.zero;
                }

                // force the player to a stand still
                _player.Move(Vector3.zero, false, false);
            }

            // check if we have set IsGameOver to true, only run this logic once
            if (_goalEffect != null && !_isGameOver)
            {
                _isGameOver = true;
                _goalEffect.PlayEffect();
                WinScreen.Open();
            }
        }
        private IEnumerator WinRoutine()
        {
            TransitionFader.PlayTransition(_endTransitionPrefab);
            float fadeDelay = (_endTransitionPrefab != null) ? _endTransitionPrefab.Delay + _endTransitionPrefab.FadeOnDuration : 0f;

            yield return(new WaitForSeconds(fadeDelay));

            WinScreen.Open();
        }
Beispiel #3
0
 public void LevelWin()
 {
     if (Player.IsActive)
     {
         WinScreen.Open();
         LevelScoreManager.Instance.UpdateLevelScoreDisplay();
         StopPlayerMovement();
         StopEnemiesMovement();
         StopLava();
         DataManager.instance.CompareDataAfterLevel();
     }
 }
Beispiel #4
0
    // level complete coroutine
    private IEnumerator WinRoutine()
    {
        TransitionFader.PlayTransition(_transitionPrefab);

        float fadeDelay = (_transitionPrefab != null) ?
                          _transitionPrefab.Delay + _transitionPrefab.FadeOnDuration : 0f;

        yield return(new WaitForSeconds(fadeDelay));

#if UNITY_ADS
        UnityAdsPlayer.Instance.PlayAd();
#endif
        // TODO: ALTER THIS IF NOT IN TUTORIAL
        if (LevelLoader.CurrentSceneIndex == 6)
        {
            FinishMenu.Open();
        }
        else
        {
            WinScreen.Open();
        }
    }