public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; var xmlSerializer = new XmlSerializer(typeof(Tilemap)); tilemap = (Tilemap)xmlSerializer.Deserialize(new FileStream("Content/Main_Level.tmx", FileMode.Open)); bossrooms = new List<Tilemap>(); for (int i = 1; i < 5; i++) { bossrooms.Add((Tilemap)xmlSerializer.Deserialize(new FileStream("Content/bossroom" + i + ".tmx", FileMode.Open))); } currentMap = tilemap; lastMap = currentMap; }
private void setCurrentMap() { var tp = somePlayer.GetBehaviourOfType("TeleportBehaviour") as TeleportBehaviour; foreach (var a in tp.WhichLevel) { if(a.Value) { if(a.Key == 0 && !(currentMap == tilemap)) { currentMapInt = 0; currentMap = tilemap; tilemap.Build(Content); LoadGameObjects(); somePlayer.Position = tp.SpawnPoint[a.Key]; } else if (a.Key != 0) { currentMapInt = a.Key; currentMap = bossrooms[a.Key - 1]; bossrooms[a.Key - 1].Build(Content); LoadGameObjects(); somePlayer.Position = tp.SpawnPoint[a.Key]; } } } }