예제 #1
0
파일: Bomb.cs 프로젝트: SsSanzo/BombEISTIv2
 public void CheckDestroyed(Game g)
 {
     Entity theRightDestroyed = new SoftBlock(this.X + this.Power, this.Y);
     if(this.X + this.Power >= Game.Length)
     {
         theRightDestroyed = new HardBlock(Game.Length, this.Y);
     }
     Entity theLeftDestroyed = new SoftBlock(this.X - this.Power, this.Y);
     if(this.X - this.Power <= -1)
     {
         theLeftDestroyed = new HardBlock(-1, this.Y);
     }
     Entity theUpDestroyed = new SoftBlock(this.X, this.Y - this.Power);
     if(this.Y - this.Power <= -1)
     {
         theUpDestroyed = new HardBlock(this.X, -1);
     }
     Entity theDownDestroyed = new SoftBlock(this.X, this.Y + this.Power);
     if(this.Y + this.Power >= Game.Length)
     {
         theDownDestroyed = new HardBlock(this.X, Game.Length);
     }
     Texture._.Explosion(this, g, theLeftDestroyed, theUpDestroyed, theRightDestroyed, theDownDestroyed, null);
 }
예제 #2
0
        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
                             )));
                     });
            }
        }
예제 #3
0
        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;
            }
        }