public void ExplosionFreeze(Bomb b, Game game, Entity e, Direction d, int offset) { //var g = newgif(); switch (d) { case Direction.Left: //g.Margin = new Thickness(b.X * 40 - offset, b.Y * 40, 0.0, 0.0); if (offset % 40 == 0) { InsertTextureEntity(new EntityOfDeath(b.X - offset / 40, b.Y, game, b.Owner, false, 1)); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.X - ((double)offset) / 40.0) <= (double)(e.X + 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.X - ((double)offset) / 40.0) <= (double)(e.X))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Right: //g.Margin = new Thickness(b.X * 40 + offset, b.Y * 40, 0.0, 0.0); if (offset % 40 == 0) { InsertTextureEntity(new EntityOfDeath(b.X + offset / 40, b.Y, game, b.Owner, false, 1)); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.X + ((double)offset) / 40.0) >= (double)(e.X - 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.X + ((double)offset) / 40.0) >= (double)e.X)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Up: //g.Margin = new Thickness(b.X * 40, b.Y * 40 - offset, 0.0, 0.0); if (offset % 40 == 0) { InsertTextureEntity(new EntityOfDeath(b.X, b.Y - offset / 40, game, b.Owner, false, 1)); } // Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.Y - ((double)offset) / 40.0) <= (double)(e.Y + 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.Y - ((double)offset) / 40.0) <= (double)(e.Y))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Down: //g.Margin = new Thickness(b.X * 40, b.Y * 40 + offset, 0.0, 0.0); if (offset % 40 == 0) { InsertTextureEntity(new EntityOfDeath(b.X, b.Y + offset / 40, game, b.Owner, false, 1)); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.Y + ((double)offset) / 40.0) >= (double)(e.Y - 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.Y + ((double)offset) / 40.0) >= (double)e.Y)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, e, d, offset + offsetglobal ))); }); } } break; } }
public void ExplosionFlower(Bomb b, Game game, Entity e, Direction d, int offset) { //var g = newgif(); switch (d) { case Direction.Left: //g.Margin = new Thickness(b.X * 40 - offset, b.Y * 40, 0.0, 0.0); if (offset % 40 == 0) { //new EntityOfDeath(b.X - offset / 40, b.Y, game, b.Owner); if (ListenerGame._.GameInProgress.TheCurrentMap.GetPlayer(b.X - offset / 40, b.Y) == null) { var sf = new SoftBlock(b.X - offset/40, b.Y); Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ListenerGame._.GameInProgress.TheCurrentMap.ListOfSoftBlock.Add(sf))); InsertTextureEntity(sf); } } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.X - ((double)offset) / 40.0) <= (double)(e.X + 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.X - ((double)offset) / 40.0) <= (double)(e.X))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Right: //g.Margin = new Thickness(b.X * 40 + offset, b.Y * 40, 0.0, 0.0); if (offset % 40 == 0) { if (ListenerGame._.GameInProgress.TheCurrentMap.GetPlayer(b.X + offset / 40, b.Y) == null) { var sf = new SoftBlock(b.X + offset / 40, b.Y); Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ListenerGame._.GameInProgress.TheCurrentMap.ListOfSoftBlock.Add(sf))); InsertTextureEntity(sf); } //new EntityOfDeath(b.X + offset / 40, b.Y, game, b.Owner); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.X + ((double)offset) / 40.0) >= (double)(e.X - 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.X + ((double)offset) / 40.0) >= (double)e.X)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Up: //g.Margin = new Thickness(b.X * 40, b.Y * 40 - offset, 0.0, 0.0); if (offset % 40 == 0) { if (ListenerGame._.GameInProgress.TheCurrentMap.GetPlayer(b.X, b.Y - offset / 40) == null) { var sf = new SoftBlock(b.X, b.Y - offset / 40); Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ListenerGame._.GameInProgress.TheCurrentMap.ListOfSoftBlock.Add(sf))); InsertTextureEntity(sf); } //new EntityOfDeath(b.X, b.Y - offset / 40, game, b.Owner); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.Y - ((double)offset) / 40.0) <= (double)(e.Y + 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.Y - ((double)offset) / 40.0) <= (double)(e.Y))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } break; case Direction.Down: //g.Margin = new Thickness(b.X * 40, b.Y * 40 + offset, 0.0, 0.0); if (offset % 40 == 0) { if (ListenerGame._.GameInProgress.TheCurrentMap.GetPlayer(b.X, b.Y + offset / 40) == null) { var sf = new SoftBlock(b.X, b.Y + offset / 40); Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ListenerGame._.GameInProgress.TheCurrentMap.ListOfSoftBlock.Add(sf))); InsertTextureEntity(sf); } //new EntityOfDeath(b.X, b.Y + offset / 40, game, b.Owner); } //Mw.explosion(g); if (e is HardBlock) { if (!(((double)b.Y + ((double)offset) / 40.0) >= (double)(e.Y - 1))) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } else { if (!(((double)b.Y + ((double)offset) / 40.0) >= (double)e.Y)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFlower(b, game, e, d, offset + offsetglobal ))); }); } } break; } }
public void ExplosionFreeze(Bomb b2, Game game, Entity Left, Entity Up, Entity Right, Entity Down, Entity None) { var b = new Bomb(b2.X, b2.Y, b2.Power, b2.Owner, false); //var g = newgif(); //g.Margin = new Thickness(b.X * 40, b.Y * 40, 0.0, 0.0); //Mw.explosion(g); InsertTextureEntity(new EntityOfDeath(b.X, b.Y, game, b2.Owner, true, 1)); if (Left == null) { if (b.X - b.Power < 0) { Left = new HardBlock(-1, 0); } else { Left = new SoftBlock(b.X - b.Power, 0); } } if (Right == null) { if (b.X + b.Power >= Game.Length) { Right = new HardBlock(Game.Length, 0); } else { Right = new SoftBlock(b.X + b.Power, 0); } } if (Down == null) { if (b.Y + b.Power >= Game.Length) { Down = new HardBlock(0, Game.Length); } else { Down = new SoftBlock(0, b.Y + b.Power); } } if (Up == null) { if (b.Y - b.Power < 0) { Up = new HardBlock(0, -1); } else { Up = new SoftBlock(0, b.Y - b.Power); } } if (!(Left is HardBlock && b.X == Left.X + 1)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, Left, Direction.Left, offsetglobal ))); }); } if (!(Right is HardBlock && b.X == Right.X - 1)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, Right, Direction.Right, offsetglobal ))); }); } if (!(Up is HardBlock && b.Y == Up.Y + 1)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, Up, Direction.Up, offsetglobal ))); }); } if (!(Down is HardBlock && b.Y == Down.Y - 1)) { TimerManager._.AddNewTimer(false, timeoffset, true, null, delegate { Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => ExplosionFreeze(b, game, Down, Direction.Down, offsetglobal ))); }); } }
public void PutMultipleBomb() { if(secAvaliable) { var lb = _map.GetAroundEntity(X, Y); if (lb.FirstOrDefault(c => c.X == X - 1 && c.Y == Y) == null && X - 1 > -1) { var bi = new Bomb(X - 1, Y, BombPower, this, true, BombType.Move); ListenerGame._.GameInProgress.TheCurrentMap.ListOfBomb.Add(bi); Texture._.InsertTextureEntity(bi); bi.Move(Direction.Left); } if (lb.FirstOrDefault(c => c.X == X + 1 && c.Y == Y) == null && X + 1 < Game.Length) { var bi = new Bomb(X + 1, Y, BombPower, this, true, BombType.Move); ListenerGame._.GameInProgress.TheCurrentMap.ListOfBomb.Add(bi); Texture._.InsertTextureEntity(bi); bi.Move(Direction.Right); } if (lb.FirstOrDefault(c => c.X == X && c.Y == Y - 1) == null && Y - 1 > -1) { var bi = new Bomb(X, Y - 1, BombPower, this, true, BombType.Move); ListenerGame._.GameInProgress.TheCurrentMap.ListOfBomb.Add(bi); Texture._.InsertTextureEntity(bi); bi.Move(Direction.Up); } if (lb.FirstOrDefault(c => c.X == X && c.Y == Y + 1) == null && Y + 1 < Game.Length) { var bi = new Bomb(X, Y + 1, BombPower, this, true, BombType.Move); ListenerGame._.GameInProgress.TheCurrentMap.ListOfBomb.Add(bi); Texture._.InsertTextureEntity(bi); bi.Move(Direction.Down); } Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.BombImage[this.Id].Opacity = 0.4)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Content = Stack)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Opacity = 1)); secAvaliable = false; TimerManager._.AddNewTimer(false, this.stack * 1000, true, null, beAvaliable); TimerManager._.AddNewTimer(true, 1000, true, null, ChangeTheCD); } }
public Bomb PutABomb(bool spec = false) { Bomb b = null; if(!spec) { var bm = (Bomb) _map.GetBomb(X, Y); if (AvailableBombCount >= 1 && (bm == null)) { b = new Bomb(X, Y, BombPower, this); AvailableBombCount--; } }else if(secAvaliable && bomb != BombType.None) { if(bomb != BombType.Teleguide) { b = new Bomb(X, Y, BombPower, this, true, BombSecond); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.BombImage[this.Id].Opacity = 0.4)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Content = Stack)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Opacity = 1)); secAvaliable = false; TimerManager._.AddNewTimer(false, this.stack * 1000, true, null, beAvaliable); TimerManager._.AddNewTimer(true, 1000, true, null, ChangeTheCD); }else { b = new Bomb(X, Y, BombPower, this, false, BombSecond); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.BombImage[this.Id].Opacity = 0.4)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Content = Stack)); Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => InGameMenu._.cdLabel[this.Id].Opacity = 1)); secAvaliable = false; MyBombTeleguide = b; //TimerManager._.AddNewTimer(false, this.stack * 1000, true, null, beAvaliable); } } return b; }
public Player BombExploded(Bomb b) { if(b.Owner == this && b.Type == BombType.Normal) { AvailableBombCount++; } return this; }
public Bomb PutABomb() { Bomb b = null; if(AvailableBombCount >= 1){ b = new Bomb(X,Y,BombPower,this); AvailableBombCount--; } return b; }
public Player BombExploded(Bomb b) { if(b.Owner == this) { AvailableBombCount++; } return this; }