Ejemplo n.º 1
0
 private void LateUpdate()
 {
     if (NumOfEnemyOnScene != 0 && NumOfEnemyOnScene == NumOfDestroedEnemyOnScene)
     {
         OnLevelEnded.InvokeSafely();
     }
 }
 protected void EndLevel()
 {
     Debug.Log(
         message: "Level end fired.");
     levelEnded = true;
     OnLevelEnded?.Invoke();
 }
Ejemplo n.º 3
0
 public void CheckNextTrash()
 {
     if (trashes.Count > 0)
     {
         Spawn();
     }
     else
     {
         Level.isComplete = true;
         OnLevelEnded.Invoke();
     }
 }
Ejemplo n.º 4
0
    public void SetTrash(int i)
    {
        currentTrashIndex += i;

        if (currentTrashIndex < Level.trashes.Count)
        {
            Trash.TrashItem = Level.trashes[currentTrashIndex];
        }
        else
        {
            Level.isComplete = true;
            OnLevelEnded.Invoke();
        }
    }
Ejemplo n.º 5
0
        /// <summary>
        /// Load the level according to <c>_curLevelID</c>,
        /// unload the previous loaded level, and reset the static manager
        /// </summary>
        private void LoadLevel()
        {
            // If the level is loaded before the game started, unload it by SceneManager
            // Because it's not loaded by the SceneLoader
            if (!string.IsNullOrEmpty(_initialLoadedScenePath))
            {
                SceneManager.UnloadSceneAsync(_initialLoadedScenePath);
                _initialLoadedScenePath = "";
            }
            else if (_curLevelHandle.IsValid())
            {
                SceneLoader.UnloadScene(_curLevelHandle, OnLevelUnLoaded);
            }

            GamePause();
            OnLevelEnded?.Invoke();

            SceneLoader.LoadScene(
                _levelData.GetLevelScene(curLevelID), LoadSceneMode.Additive,
                OnLevelLoaded);
        }