public void EmptyTheTrash(Map m) { foreach (var e in ToDelete) { if (e is Bomb) { var theBomb = m.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y); m.ListOfBomb.Remove(theBomb); } else if (e is Player) { var thePlayer = m.ListOfPlayer.First(c => c.X == e.X && c.Y == e.Y); thePlayer.Die(); m.ListOfPlayer.Remove(thePlayer); } else if (e is SoftBlock) { var theSoftBlock = m.ListOfSoftBlock.First(c => c.X == e.X && c.Y == e.Y); theSoftBlock.Destroy(m); m.ListOfSoftBlock.Remove(theSoftBlock); } else if (e is Upgrade) { var theUpgrade = m.ListOfUpgrade.First(c => c.X == e.X && c.Y == e.Y); theUpgrade.Burn(); m.ListOfUpgrade.Remove(theUpgrade); } } ToDelete.Clear(); }
public Player(int id, int x, int y, Map map, Score score = null) : base(x, y) { _id = id; if(score == null) { _score = new Score(id); } _upgrades = new List<Upgrade>(); _map = map; InitSkills(); }
public ClassicGame() { gp = GameParameters.Parameters; gp.Type = GameType.Classic; TheCurrentMap = new Map(); TheCurrentMap.SetHardBlockOnMap(); TheCurrentMap.SetSoftBlockOnMap(gp); InitPlayers(gp.NumberOfPlayer); _timer = new Timer(); _timer.Elapsed += HurryUp; _timer.AutoReset = false; _timer.Interval = gp.GameTime - 30000; Start(); }
public void Explode(Map m, Game g) { var toBeDestroyed = new List<Entity>(); var thecompletelist = m.GetCompleteList(); m.ListOfBomb.Remove(this); var l = thecompletelist.Where(c => c.X == this.X || c.Y == this.Y); var theRightDestroyed = this.GiveTheFirst(l, Direction.Right); if (theRightDestroyed != null && !g.ToDelete.Contains(theRightDestroyed)) { toBeDestroyed.Add(theRightDestroyed); } var theLeftDestroyed = this.GiveTheFirst(l, Direction.Left); if (theLeftDestroyed != null && !g.ToDelete.Contains(theLeftDestroyed)) { toBeDestroyed.Add(theLeftDestroyed); } var theUpDestroyed = this.GiveTheFirst(l, Direction.Up); if (theUpDestroyed != null && !g.ToDelete.Contains(theUpDestroyed)) { toBeDestroyed.Add(theUpDestroyed); } var theDownDestroyed = this.GiveTheFirst(l, Direction.Down); if (theDownDestroyed != null && !g.ToDelete.Contains(theDownDestroyed)) { toBeDestroyed.Add(theDownDestroyed); } foreach (var e in toBeDestroyed) { if (e is Bomb) { var theBomb = m.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y); theBomb.Explode(m, g); } } g.ToDelete.AddRange(toBeDestroyed); if (!g.ToDelete.Contains(this)) { g.ToDelete.Add(this); } Owner.BombExploded(this); }