private void FromWorldMap(Stream dat) { var map = new Wmap(Manager.GameData); Map = map; entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; Obstacles = new byte[w, h]; for (var y = 0; y < h; y++) { for (var x = 0; x < w; x++) { try { var tile = Map[x, y]; ObjectDesc desc; if (Manager.GameData.Tiles[tile.TileId].NoWalk) { Obstacles[x, y] = 3; } if (Manager.GameData.ObjectDescs.TryGetValue(tile.ObjType, out desc)) { if (desc.Class == "Wall" || desc.Class == "ConnectedWall" || desc.Class == "CaveWall") { Obstacles[x, y] = 2; } else if (desc.OccupySquare || desc.EnemyOccupySquare) { Obstacles[x, y] = 1; } } } catch (Exception ex) { Log.Error(ex); } } } EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); foreach (var i in Map.InstantiateEntities(Manager)) { if (i.ObjectDesc != null && (i.ObjectDesc.OccupySquare || i.ObjectDesc.EnemyOccupySquare)) { Obstacles[(int)(i.X - 0.5), (int)(i.Y - 0.5)] = 2; } EnterWorld(i); } }
// Reloads the level and reinitializes Mario to his default state. public void Reset() { Enemies.Clear(); Blocks.Clear(); Pipes.Clear(); Coins.Clear(); Checkpoints.Clear(); Flagpoles.Clear(); levelData.Clear(); InvisibleBarrier = new InvisibleBarrier(Vector2.Zero); CoinRoomPosition = Vector2.Zero; DynamicObjects.Clear(); StaticObjects.Clear(); PowerUpState = false; Mario.Instance.ResetPlayer(); SoundManager.Instance.gameOverPlayOnce = true; levelData = ParseLevelCSV(fileName); BuildLevel(levelData); }
public void Initialize() { StaticObjects.Clear(); DynamicObjects.Clear(); NonCollidableObjects.Clear(); dynamicLoader.Initialize(); }
protected void FromWorldMap(Stream dat) { log.InfoFormat("Loading map for world {0}({1})...", Id, Name); Map = new Wmap(Manager.GameData); entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); PetsCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); Pets.Clear(); foreach (Entity i in Map.InstantiateEntities(Manager)) { EnterWorld(i); } CheckDisposable(); }
public void Dispose() { Players.Clear(); Enemies.Clear(); Quests.Clear(); Pets.Clear(); Projectiles.Clear(); StaticObjects.Clear(); Timers.Clear(); }
protected void FromWorldMap(Stream dat) { log.InfoFormat("Loading map for world {0}({1})...", Id, Name); var map = new Wmap(); Map = map; entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; Obstacles = new byte[w, h]; for (var y = 0; y < h; y++) { for (var x = 0; x < w; x++) { var tile = Map[x, y]; ObjectDesc desc; if (XmlDatas.TileDescs[tile.TileId].NoWalk) { Obstacles[x, y] = 3; } if (XmlDatas.ObjectDescs.TryGetValue(tile.ObjType, out desc)) { if (desc.Class == "Wall" || desc.Class == "ConnectedWall" || desc.Class == "CaveWall") { Obstacles[x, y] = 2; } else if (desc.OccupySquare || desc.EnemyOccupySquare) { Obstacles[x, y] = 3; } } } } EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); foreach (var i in Map.InstantiateEntities(Manager)) { if (i.ObjectDesc != null && (i.ObjectDesc.OccupySquare || i.ObjectDesc.EnemyOccupySquare)) { Obstacles[(int)(i.X - 0.5), (int)(i.Y - 0.5)] = 2; } EnterWorld(i); } }
public virtual void Dispose() { Players.Clear(); Enemies.Clear(); Quests.Clear(); Projectiles.Clear(); StaticObjects.Clear(); Timers.Clear(); EnemiesCollision = null; PlayersCollision = null; }
protected void FromWorldMap(System.IO.Stream dat) { Wmap map = new Wmap(); this.Map = map; entityInc = 0; entityInc += map.Load(dat, 0); int w = map.Width, h = map.Height; Obstacles = new byte[w, h]; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { var tile = map[x, y]; ObjectDesc desc; if (XmlDatas.TileDescs[tile.TileId].NoWalk) { Obstacles[x, y] = 3; } if (XmlDatas.ObjectDescs.TryGetValue(tile.ObjType, out desc)) { if (desc.Class == "Wall" || desc.Class == "ConnectedWall" || desc.Class == "CaveWall") { Obstacles[x, y] = 2; } else if (desc.OccupySquare || desc.EnemyOccupySquare) { Obstacles[x, y] = 1; } } } } EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); foreach (var i in map.InstantiateEntities()) { if (i.ObjectDesc != null && (i.ObjectDesc.OccupySquare || i.ObjectDesc.EnemyOccupySquare)) { Obstacles[(int)(i.X - 0.5), (int)(i.Y - 0.5)] = 2; } EnterWorld(i); } }
/// <summary> /// Заполнить по номеру уровня /// </summary> /// <param name="iLevel"></param> public void FillStage(int iLevel) { StaticObjects.Clear(); DynamicObjects.Clear(); /* * switch (iLevel) * { * case 1: * h_FillStage1(); * break; * }*/ h_FillByFile(iLevel); }
private void InitMap() { int w = Map.Width, h = Map.Height; EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); Quests.Clear(); Timers.Clear(); foreach (var i in Map.InstantiateEntities(Manager)) { EnterWorld(i); } }