Esempio n. 1
0
        public override void LoadContent()
        {
            behindMC            = new List <Sprite>();
            frontMC             = new List <Sprite>();
            toRemove            = new List <PickableObject>();
            Game1.mc.position   = mcPos;
            nonPlayerObjects    = new List <Sprite>();
            decorativeObjects   = new List <DecorativeObject>();
            interactableObjects = new List <Interactable>();
            loadingZones        = new List <LoadingZone>();
            cutsceneTriggers    = new List <CutsceneTrigger>();
            for (int i = 0; i < 5; i++)
            {
                List <Tuple <string, Vector2> > thisData = GameData.levelData[name][i];
                switch (i)
                {
                case 0:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        GameObject obj = new GameObject(GameData.allObjects[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                    }
                    break;

                case 1:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        InteractableObject obj = new InteractableObject(GameData.allInteractables[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 2:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        PickableObject obj = new PickableObject(GameData.allPickables[thisTup.Item1], thisTup.Item2, thisTup.Item1, this);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 3:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        NPC obj = new NPC(GameData.allCharacters[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 4:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        DecorativeObject obj = new DecorativeObject(GameData.allDecoratives[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        decorativeObjects.Add(obj);
                        interactableObjects.Add(obj);
                        nonPlayerObjects.Add(obj);
                    }
                    break;
                }
            }
            foreach (Rectangle iwrect in GameData.invisibleWallData[name])
            {
                InvisibleWall iv = new InvisibleWall(iwrect);
                nonPlayerObjects.Add(iv);
            }
            foreach (List <object> CSData in GameData.triggerData[name])
            {
                cutsceneTriggers.Add(new CutsceneTrigger((Rectangle?)CSData[0], (string)CSData[1], (int)CSData[2], (string)CSData[3], (string)CSData[4], (int)CSData[5]));
            }
            nonPlayerObjects.Sort(new Util.Sorter());
            foreach (Sprite s in nonPlayerObjects)
            {
                Debug.WriteLine(s.position);
            }
            decorativeObjects.Sort(new Util.Sorter());
            foreach (List <object> LZData in GameData.loadingZoneData[name])
            {
                loadingZones.Add(new LoadingZone((Rectangle)LZData[0], (string)LZData[1], (bool)LZData[2], (Vector2)LZData[3], (int)LZData[4]));
            }
            gameMap             = new Map(GameData.allMaps[name]);
            Game1.mc.currGState = this;
            // MediaPlayer.Play(BGM);
        }
Esempio n. 2
0
        public override void ReloadContent()
        {
            reloading = true;
            nonPlayerObjects.Clear();
            decorativeObjects.Clear();
            interactableObjects.Clear();
            loadingZones.Clear();
            cutsceneTriggers.Clear();
            for (int i = 0; i < 5; i++)
            {
                List <Tuple <string, Vector2> > thisData = GameData.levelData[name][i];
                switch (i)
                {
                case 0:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        GameObject obj = new GameObject(GameData.allObjects[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                    }
                    break;

                case 1:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        InteractableObject obj = new InteractableObject(GameData.allInteractables[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 2:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        PickableObject obj = new PickableObject(GameData.allPickables[thisTup.Item1], thisTup.Item2, thisTup.Item1, this);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 3:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        NPC obj = new NPC(GameData.allCharacters[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        nonPlayerObjects.Add(obj);
                        interactableObjects.Add(obj);
                    }
                    break;

                case 4:
                    foreach (Tuple <string, Vector2> thisTup in thisData)
                    {
                        DecorativeObject obj = new DecorativeObject(GameData.allDecoratives[thisTup.Item1], thisTup.Item2, thisTup.Item1);
                        decorativeObjects.Add(obj);
                        interactableObjects.Add(obj);
                        nonPlayerObjects.Add(obj);
                    }
                    break;
                }
            }
            foreach (Rectangle iwrect in GameData.invisibleWallData[name])
            {
                InvisibleWall iv = new InvisibleWall(iwrect);
                nonPlayerObjects.Add(iv);
            }
            foreach (List <object> CSData in GameData.triggerData[name])
            {
                cutsceneTriggers.Add(new CutsceneTrigger((Rectangle?)CSData[0], (string)CSData[1], (int)CSData[2], (string)CSData[3], (string)CSData[4], (int)CSData[5]));
            }
            nonPlayerObjects.Sort(new Util.Sorter());
            decorativeObjects.Sort(new Util.Sorter());
            foreach (List <object> LZData in GameData.loadingZoneData[name])
            {
                loadingZones.Add(new LoadingZone((Rectangle)LZData[0], (string)LZData[1], (bool)LZData[2], (Vector2)LZData[3], (int)LZData[4]));
            }
            reloading = false;
        }