private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { if (Instance == this) { LevelLoaded?.Invoke(arg0.buildIndex); } }
public IEnumerator LoadLevelWeb(int id, LevelLoaded levelLoaded) { while (!loadedMonsters || !loadedTowers) { yield return(new WaitForSeconds(0.25f)); } WWW www = null; #if !UNITY_EDITOR int indexPageIndex = Application.absoluteURL.IndexOf("index.html"); if (indexPageIndex < 0) { indexPageIndex = Application.absoluteURL.Length; } baseUrl = Application.absoluteURL.Substring(0, indexPageIndex - 1); #endif www = new WWW(string.Format("{0}/Data/Level{1}.xml", this.baseUrl, id)); yield return(www); if (string.IsNullOrEmpty(www.error)) { var serializer = new XmlSerializer(typeof(LevelInfo)); TextReader textReader = new StringReader(www.text); LevelInfo levelInfo = serializer.Deserialize(textReader) as LevelInfo; textReader.Close(); levelLoaded(levelInfo); } else { levelLoaded(null); } }
public void GenerateBrick() { this.RemainingBricks = new List <Brick>(); int[,] currentLevelMatrix = this.levels[this.currentLevel]; float currentX = _firstBrickX; float currentY = _firstBrickY; for (int i = 0; i < this._maxRows; i++) { for (int j = 0; j < this._maxCols; j++) { int brickType = currentLevelMatrix[i, j]; if (brickType > 0) { Brick newBrick = Instantiate(_brickPrefab, new Vector3(currentX, currentY, -6), Quaternion.identity); newBrick.Init(_bricksContainer.transform, this.mats[brickType - 1], this.colors[brickType - 1], brickType); this.RemainingBricks.Add(newBrick); } currentX += _shiftX; if (j + 1 == this._maxCols) { currentX = _firstBrickX; } } currentY -= _shiftY; } this.initialBrickNo = this.RemainingBricks.Count; LevelLoaded?.Invoke(); }
private void OnLevelLoaded(LevelLoaded L) { if (L.Index == LevelIndex && gameObject.activeSelf) { RemainedDisappearBubble = DisappearBubbleInitNum; RemainedNormalBubble = NormalBubbleInitNum; } }
private void OnLevelLoadComplete(AsyncOperationHandle <SceneInstance> handle) { if (handle.Status != AsyncOperationStatus.Succeeded) { return; } _loaded = true; _sceneHandle = handle; LevelLoaded?.Invoke(); }
public void LoadLevel(LevelType levelType) { if (_currentLevel != null) { GameObject.Destroy(_currentLevel); LevelUnloaded?.Invoke(); } _currentLevel = GameObject.Instantiate(Data.Instance.LevelData.GetPrefab(levelType)); Services.Instance.LevelService.CurrentLevel = levelType; Time.timeScale = 1; LevelLoaded?.Invoke(); }
private void Start() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } if (LevelLoaded.GetPersistentEventCount() > 0) { LevelLoaded.Invoke(); } }
private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (scene == gameObject.scene) { return; } if (!scene.IsValid()) { return; } var isCommon = scene.path == gameScene.ScenePath; var isMainMenu = scene.path == mainMenuScene.ScenePath; if (!isCommon) { loadingScreen.Show(false, true); } // Start network things when game scene is loaded. if (isCommon) { var nm = FindObjectOfType <NetworkManager>(); nm.ServerConfig = serverConfig; nm.StartNet(this, NetworkMode, ServerAddress); if (nm.Client is NetworkClient nc) { nc.StatusChanged += OnNetworkStatus; } return; } // Set last loaded level as active scene. SceneManager.SetActiveScene(scene); if (isMainMenu) { FindObjectOfType <MainMenu>().Preferences = Preferences; return; } LevelLoaded?.Invoke(this, scene.name); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); load = null; SceneManager.sceneLoaded += OnSceneLoaded; } else if (instance != this) { // Have to reset this to the old gameManager as the currently reference the one in scene GameObject.Find("StartVRButton").GetComponent <Button>().onClick.AddListener( () => { instance.gameObject.GetComponent <KartManager>().SetIsVR(true); }); GameObject.Find("StartMobileButton").GetComponent <Button>().onClick.AddListener( () => { instance.gameObject.GetComponent <KartManager>().SetIsVR(false); }); GameObject.Find("StartMobileButton").GetComponent <Button>().onClick.AddListener( () => { instance.LoadScene("Level1"); }); // Destroy instance that is in this scene as you don't want duplciates Destroy(gameObject); } }
public void SetMap(LevelStats levelStats) { _levelStats = levelStats; LevelLoaded?.Invoke(this, new LevelLoadedArgs(_levelStats)); }
public void AddLoadCallback(LevelLoaded callback) { load += callback; }
public void ResetLevel() { Utils.ScoreCounter.ResetScore(); Utils.PickupSpawner.ResetState(); LevelLoaded?.Invoke(); }
private void Start() { LevelLoaded?.Invoke(); }
void Start() { levelDB = GetComponent<LevelDataBase>(); levelLoad = GetComponent<LevelLoaded>(); launchSettings = GameObject.Find("LaunchSettings").GetComponent<LaunchSettings>(); launchSettings.SetAllToFalse(); }
protected virtual void OnLevelLoaded(string level) { LevelLoaded?.Invoke(this, level); }
public void Handle(LevelLoaded message) { _level = message.Level; }