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 skinid, int x, int y, Map map, Score score = null) : base(x, y) { _id = id; _skinid = skinid; _upgrades = new List<Upgrade>(); _upgradesBomb = new List<UpgradeBomb>(); _map = map; InitSkills(); }
public ClassicGame() { GameParameters._.Type = GameType.Classic; Map = new Map(); Map.SetHardBlockOnMap(); Map.SetSoftBlockOnMap(); InitPlayers(GameParameters._.PlayerCount); var timer = TimerManager._.GetNewTimer(false, GameParameters._.GameTime - 30000); TimerManager._.GetTimer(timer).Elapsed += HurryUp; Start(); }
public CrazyGame(GameScreen wiz = null) { w = wiz; theGameIsOver = false; GameParameters._.Type = GameType.Crazy; TheCurrentMap = new Map(); TheCurrentMap.SetHardBlockOnMap(); TheCurrentMap.SetSoftBlockOnMapCrazy(); InitPlayersCrazy(); TimerManager._.AddNewTimer(true, 1000, false, null, ChangeTime); TimerManager._.AddNewTimer(false, GameParameters._.GameTime * 1000, false, null, EndOfTheGame); }
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(GameScreen wiz = null) { w = wiz; theGameIsOver = false; GameParameters._.Type = GameType.Classic; TheCurrentMap = new Map(); TheCurrentMap.SetHardBlockOnMap(); TheCurrentMap.SetSoftBlockOnMap(); InitPlayers(); TimerManager._.AddNewTimer(true, 1000, false, null, ChangeTime); TimerManager._.AddNewTimer(false, GameParameters._.GameTime * 1000 - 45000, false, null, HurryUp); }
public void Destroy(Map m) { if(MyUpgrade != null) { m.ListOfUpgrade.Add(MyUpgrade); Texture._.InsertTextureEntity(MyUpgrade); }else if(MyBombSec != null) { m.ListOfUpgradeBomb.Add(MyBombSec); Texture._.InsertTextureEntity(MyBombSec); } }
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); }
public bool Teleport(Map m) { if(itération < 3) { var list = m.GetCompleteList().ToList(); var l = new List<HardBlock>(); for (var i = 0; i < Game.Length; i++) { for (var j = 0; j < Game.Length; j++) { if (list.FirstOrDefault(c => c != null && c.X == i && c.Y == j) == null) { Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => l.Add(new HardBlock(i, j)))); } } } if (l == null || l.Count() == 0) return true; var rand = new Random(); var n = rand.Next(l.Count); this.X = l.ElementAt(n).X; this.Y = l.ElementAt(n).Y; Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action((reloadTickLeft))); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action((reloadTickTop))); itération++; return true; } return false; }