示例#1
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
                             )));
                     });
            }
        }
示例#2
0
        public void InsertEndingBlock()
        {
            HardBlock entity = null;
            if(hb == null)
            {
                entity = new HardBlock(0,0);
                TheCurrentMap.DestroyEverythingHere(entity.X,entity.Y);
            }else
            {
                if (hb.Y == tour && hb.X != Length - 1 - tour)
                {
                    entity = new HardBlock(hb.X + 1, hb.Y);
                }
                else if (hb.X == Length - 1 - tour && hb.Y != Length - 1 - tour)
                {
                    entity = new HardBlock(hb.X, hb.Y + 1);
                }
                else if (hb.Y == Length - 1 - tour && hb.X != tour)
                {
                    entity = new HardBlock(hb.X - 1, hb.Y);
                }
                else if (hb.X == tour && hb.Y != tour + 1)
                {
                    entity = new HardBlock(hb.X, hb.Y - 1);

                }
                if (entity.X == tour && entity.Y == tour + 1)
                {
                    tour++;
                }
                TheCurrentMap.DestroyEverythingHere(entity.X, entity.Y);
            }
            entity.Source = Texture._.TypetextureList["EndBlock"];
            entity.Width = 40;
            entity.Height = 40;
            Texture._.Mw.MainGrid.Children.Add(entity);
            TheCurrentMap.ListOfHardBlock.Add(entity);
            hb = entity;
        }
示例#3
0
 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);
 }
示例#4
0
 public void HurryUp(object sender, ElapsedEventArgs elapsedEventArgs)
 {
     Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => PlaySound._.Stop("Game")));
     Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => PlaySound._.TypeMusicList["Quick"].Play()));
     Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>PlaySound._.TypeMusicList["Hurry"].Volume = 1));
     Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => PlaySound._.TypeMusicList["Hurry"].Play()));
     TimerManager._.AddNewTimer(false, 45000, true, null, EndOfTheGame);
     TimerManager._.AddNewTimer(true, 15, true, null, w.Hurry);
     hb = null;
     tour = 0;
     TimerManager._.AddNewTimer(true,80,true,null, InsertEndingBlockThread);
 }