示例#1
0
        public void SetupRenderList(Hansel pHansel, Gretel pGretel)
        {
            RenderList.Clear();
            RenderList.AddRange(InteractiveObjects);
            RenderList.AddRange(Collectables);
            RenderList.AddRange(Enemies);
            RenderList.Add(pHansel);
            RenderList.Add(pGretel);
            //Brunnen Overlay hinzufügen
            foreach (InteractiveObject iObj in InteractiveObjects)
            {
                if (iObj.ActivityId == Activity.UseWell)
                {
                    InteractiveObject wellOverlay = InteractiveObjectDataManager.Instance.GetElementByString("wellOverlay");
                    wellOverlay.SkeletonPosition = iObj.SkeletonPosition + new Vector2(-100, 300);
                    wellOverlay.ApplySettings();
                    RenderList.Add(wellOverlay);
                }
            }

            List <InteractiveObject> del = new List <InteractiveObject>();

            foreach (InteractiveObject iObj in RenderList)
            {
                if (iObj.Name.Contains("jump") || iObj.Name.Contains("slip"))
                {
                    del.Add(iObj);
                }
            }

            foreach (InteractiveObject iObj in del)
            {
                RenderList.Remove(iObj);
            }
        }
示例#2
0
        public static Savegame Load(Hansel pHansel, Gretel pGretel)         //Muss static sein damit das Savegame als solches gesetzt werden kann.
        {
            Savegame TmpSavegame;
            FileInfo file = new FileInfo(Savegame.SavegamePath);

            if (!file.Exists)
            {
                //Build Default Savegame
                TmpSavegame = new Savegame();
                TmpSavegame.Reset();
                CopyPlayerPositions(pHansel, pGretel, TmpSavegame);
                //Save new Savegame to File
                Savegame.Save(TmpSavegame, pHansel, pGretel);
                //Setup Savegame
                TmpSavegame.LoadContent();
                TmpSavegame.Scenes[TmpSavegame.SceneId].SetupRenderList(pHansel, pGretel);
                return(TmpSavegame);
            }
            //Get Savegame from File
            xmlReader   = new StreamReader(Savegame.SavegamePath);
            TmpSavegame = (Savegame)SavegameSerializer.Deserialize(xmlReader);             //Savegame aus File laden
            xmlReader.Close();
            //SetupSavegame
            CopyPlayerPositions(pHansel, pGretel, TmpSavegame);
            TmpSavegame.LoadContent();
            TmpSavegame.Scenes[TmpSavegame.SceneId].SetupRenderList(pHansel, pGretel);
            return(TmpSavegame);
        }
示例#3
0
 /// <summary>
 /// Speichert pSavegame an pSavegame.SavegamePath.
 /// </summary>
 /// <param name="pSavegame">Savegame, das gesaved werden soll.</param>
 public static void Save(Savegame pSavegame, Hansel pHansel, Gretel pGretel)         //Muss static sein damit das Savegame als solches serialisiert werden kann.
 {
     pSavegame.hansel = pHansel;
     pSavegame.gretel = pGretel;
     xmlWriter        = new StreamWriter(Savegame.SavegamePath);
     SavegameSerializer.Serialize(xmlWriter, pSavegame);             //Savegame in File schreiben
     xmlWriter.Close();
 }
示例#4
0
 public Savegame(Savegame pSavegame)
 {
     Initialize();
     Collectables = pSavegame.Collectables;
     hansel       = pSavegame.hansel;
     gretel       = pSavegame.gretel;
     SceneId      = pSavegame.SceneId;
     Scenes       = pSavegame.Scenes;
 }
示例#5
0
 protected static void CopyPlayerPositions(Hansel pHansel, Gretel pGretel, Savegame pSavegame)
 {
     pHansel.SkeletonPosition  = pSavegame.hansel.Position;
     pHansel.Position          = pSavegame.hansel.Position;
     pHansel.CollisionRectList = pSavegame.hansel.CollisionRectList;
     pGretel.SkeletonPosition  = pSavegame.gretel.Position;
     pGretel.Position          = pSavegame.gretel.Position;
     pGretel.CollisionRectList = pSavegame.gretel.CollisionRectList;
     pHansel.ApplySettings();
     pGretel.ApplySettings();
     pHansel.Lantern = pSavegame.hansel.Lantern;
     pGretel.Lantern = pSavegame.gretel.Lantern;
 }
示例#6
0
 public void Initialize()
 {
     ScenePath          = Environment.CurrentDirectory + @"\Content\hug";
     SavegamePath       = Environment.CurrentDirectory + @"\save.hugs";       //Hänsel Und Gretel Savegame
     SceneSerializer    = new XmlSerializer(typeof(SceneData));
     SavegameSerializer = new XmlSerializer(typeof(Savegame));
     Collectables       = new List <Collectable>();
     SceneId            = 0;
     Scenes             = new SceneData[19]; //ToDo: Anzahl Scenes setzen !---!---!---!---!
     for (int i = 0; i < Scenes.Length; i++)
     {
         Scenes[i] = new SceneData();                 //Scenes initialisieren
     }
     hansel = new Hansel();
     gretel = new Gretel();
 }