예제 #1
0
//		public void LoadLevel(int chapter, int level){
//
//			if (chapters[chapter] == null || chapters[chapter].levels[level] == null){
//				Debug.Log("Cannot load Level, check indexes");
//				return;
//			}
//
//			current_level = Reader.LoadLevel(chapters[chapter].levels[level].Level_text,HEIGHT,WIDTH);
//		}

        public void LoadLevel(LevelOut level_out)
        {
            current_level_out      = level_out;
            current_level          = Reader.LoadLevel(level_out.Level_text, HEIGHT, WIDTH);
            current_level_tutorial = current_level_out.Tutorial_manager;
            level_string           = "Chapter_" + current_level_out.chapter + ":" + "Level_" + current_level_out.index;
        }
        public void SetLevel(LevelOut level)
        {
            _level = level;

            //Debug.Log (level.index);
            RefreshComponents();
        }
예제 #3
0
        void DisplayLevels(int count, float start_x, float start_y)
        {
            for (int y = 1; y >= -1; y--)
            {
                for (int x = -2; x <= 1; x++)
                {
                    if (count > data.current_chapter.levels.Count - 1)
                    {
                        return;
                    }

                    LevelOut level = data.current_chapter.levels[count];

                    Vector2    position     = new Vector2((start_x + (float)x) * 2f, (start_y + (float)y) * 2.0f);
                    GameObject level_button = (GameObject)GameObject.Instantiate(level_button_reference, position, Quaternion.identity);
                    level_button.SendMessage("SetLevel", level);
                    level_button.transform.parent = transform;

                    movable_objects.Add(level_button);

                    count++;
                }
            }


            views++;
            DisplayLevels(count, start_x + 8, start_y);
        }
예제 #4
0
        public void AddLevel(Chapter chapter, LevelConfig level_config, int ch_ind, int lvl_ind)
        {
            LevelOut level = new LevelOut();

            chapter.levels.Add(level);

            level.chapter = ch_ind;
            level.index   = lvl_ind;

            level.Name             = level_config.Name;
            level.Unlocked         = level_config.unlocked;
            level.Level_text       = level_config.Level_txt;
            level.Tutorial_manager = level_config.Tutorial_Object;
        }
예제 #5
0
        private static void LoadLevel(LevelData data, LevelOut level)
        {
            level.Unlocked = data.unlocked;

            level.top_score = data.top_score;

            level.trophy_one   = data.trophy_one;
            level.trophy_two   = data.trophy_two;
            level.trophy_three = data.trophy_three;

            level.golden_trophy_one   = data.golden_trophy_one;
            level.golden_trophy_two   = data.golden_trophy_two;
            level.golden_trophy_three = data.golden_trophy_three;

            //Debug.Log ("---Level " + (level.index+1) + " loaded -- unlocked = " + level.Unlocked);
        }
예제 #6
0
        private static LevelData SaveLevel(LevelOut level)
        {
            LevelData data = new LevelData();

            data.unlocked = level.Unlocked;

            data.top_score = level.top_score;

            data.trophy_one   = level.trophy_one;
            data.trophy_two   = level.trophy_two;
            data.trophy_three = level.trophy_three;

            data.golden_trophy_one   = level.golden_trophy_one;
            data.golden_trophy_two   = level.golden_trophy_two;
            data.golden_trophy_three = level.golden_trophy_three;

            //Debug.Log ("Level " + (level.index+1) + " saved -- unlocked = " + level.Unlocked);

            return(data);
        }