예제 #1
0
    /// <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));
    }
예제 #2
0
        private void Start()
        {
            LevelLoading?.Invoke(this);

            Initialize();

            LevelLoadingDone?.Invoke(this);

            StartGame();
        }
예제 #3
0
    /// <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);
    }
예제 #5
0
        private void Start()
        {
            if (LevelLoading != null)
            {
                LevelLoading.Invoke(this, new EventArgs());
            }

            //Initialize();

            if (LevelLoadingDone != null)
            {
                LevelLoadingDone.Invoke(this, new EventArgs());
            }
            //StartGame();
        }
예제 #6
0
        private IEnumerator Start()
        {
            if (LevelLoading != null)
            {
                LevelLoading.Invoke(this, new EventArgs());
            }
            yield return(null);

            Initialize();

            if (LevelLoadingDone != null)
            {
                LevelLoadingDone.Invoke(this, new EventArgs());
            }

            StartGame();
        }
예제 #7
0
        /*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);
    }
예제 #9
0
        /// <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;
            }
        }
예제 #10
0
 // Start is called before the first frame update
 void Start()
 {
     levelLoader = FindObjectOfType <LevelLoading>();
     setMoveBounds();
 }
예제 #11
0
 // Start is called before the first frame update
 void Start()
 {
     SetUpMoveBoundries();
     levelLoading = FindObjectOfType <LevelLoading>();
 }
예제 #12
0
 private void Start()
 {
     levelLoading = FindObjectOfType <LevelLoading>();
 }