private void LateUpdate() { if (NumOfEnemyOnScene != 0 && NumOfEnemyOnScene == NumOfDestroedEnemyOnScene) { OnLevelEnded.InvokeSafely(); } }
protected void EndLevel() { Debug.Log( message: "Level end fired."); levelEnded = true; OnLevelEnded?.Invoke(); }
public void CheckNextTrash() { if (trashes.Count > 0) { Spawn(); } else { Level.isComplete = true; OnLevelEnded.Invoke(); } }
public void SetTrash(int i) { currentTrashIndex += i; if (currentTrashIndex < Level.trashes.Count) { Trash.TrashItem = Level.trashes[currentTrashIndex]; } else { Level.isComplete = true; OnLevelEnded.Invoke(); } }
/// <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); }