/// <summary> /// Check if the next level exists /// </summary> /// <returns></returns> private string GetNextLevelName() { //Get the current level id from the scene name int currentLevelID = LevelLoading.GetLevelIDFromName(SceneManager.GetActiveScene().name); return(LevelLoading.GetLevelSceneName(currentLevelID + 1)); }
private void Start() { LevelLoading?.Invoke(this); Initialize(); LevelLoadingDone?.Invoke(this); StartGame(); }
/// <summary> /// Loads this Level /// </summary> public void LoadLevel() { //Get the scene of this level and try and load it string levelName = LevelLoading.GetLevelSceneName(levelID); if (levelName != string.Empty) { SceneManager.LoadScene(levelName); } }
public static bool LoadGamelLoading(int map, int level) { string sceneName = string.Format(gameScene, map, level); if (level < JsonManager.Instance.ReadMaxLevelCount()) { LevelLoading.SetNowMapAndLevel(sceneName); SceneManager.LoadScene(gamelLoadingScene); return(true); } return(false); }
private void Start() { if (LevelLoading != null) { LevelLoading.Invoke(this, new EventArgs()); } //Initialize(); if (LevelLoadingDone != null) { LevelLoadingDone.Invoke(this, new EventArgs()); } //StartGame(); }
private IEnumerator Start() { if (LevelLoading != null) { LevelLoading.Invoke(this, new EventArgs()); } yield return(null); Initialize(); if (LevelLoadingDone != null) { LevelLoadingDone.Invoke(this, new EventArgs()); } StartGame(); }
/*private void Start() * { * Debug.Log("HI"); * * manager = GameObject.Find("Manager"); * manager.GetComponent<ManagerScript>().DeactivateGame(); * /*if (LevelLoading != null) * Debug.Log("Loading....."); * LevelLoading.Invoke(this, new EventArgs()); * * Initialize(); * * if (LevelLoadingDone != null) * //Debug.Log("Done!"); * LevelLoadingDone.Invoke(this, new EventArgs()); * * StartGame(); * }*/ public void Begin() { Debug.Log("Im at Begin"); if (LevelLoading != null) { LevelLoading.Invoke(this, new EventArgs()); } Initialize(); if (LevelLoadingDone != null) { //Debug.Log("Done!"); LevelLoadingDone.Invoke(this, new EventArgs()); } StartGame(); }
// Start is called before the first frame update void Start() { //Determine level count from the number of levels from the level loader int levelCount = LevelLoading.GetLevelCount(); int currentRow = 0; int currentRowItem = 0; //Current Item in the row for (int i = 0; i < levelCount; ++i) { //Create button GameObject button = Instantiate(levelButtonPrefab); button.transform.SetParent(contentArea); button.transform.localScale = Vector3.one; //Calculate it's postion RectTransform buttonRect = button.GetComponent <RectTransform>(); Vector3 positionInGrid = new Vector3(currentRowItem * rowSpacing, currentRow * -columnsSpacing, 0f); Vector3 createPos = startPoint + positionInGrid; buttonRect.localPosition = createPos; //Set Level ID of item LevelMenuItem levelData = button.GetComponent <LevelMenuItem>(); if (levelData != null) { levelData.InitLevelButton(i + 1, this); } //Check if we shoud go to the next row currentRowItem++; if (currentRowItem % levelsPerRow == 0) { currentRow++; currentRowItem = 0; } } //Work out the required size of the content box so that the scroll rect //works properly float requiredContentSize = Mathf.Abs(startPoint.y) + ((currentRow + 1) * columnsSpacing); contentArea.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, requiredContentSize); }
/// <summary> /// Load the corresponding scene. /// </summary> /// <param name="levelLoading">Level to load.</param> public static void OnLoadLevel(LevelLoading levelLoading) { switch (levelLoading) { case LevelLoading.PreviousLevel: LevelLoader.LoadPreviousLevel(); break; case LevelLoading.ReloadLevel: LevelLoader.ReloadLevel(); break; case LevelLoading.NextLevel: LevelLoader.LoadNextLevel(); break; case LevelLoading.FirstLevel: LevelLoader.LoadLevelByIndex(0); break; } }
// Start is called before the first frame update void Start() { levelLoader = FindObjectOfType <LevelLoading>(); setMoveBounds(); }
// Start is called before the first frame update void Start() { SetUpMoveBoundries(); levelLoading = FindObjectOfType <LevelLoading>(); }
private void Start() { levelLoading = FindObjectOfType <LevelLoading>(); }