示例#1
0
 public List<Image> AllTheBomb(Game g)
 {
     var nbplayer = g.TheCurrentMap.ListOfPlayer.Count;
     var l = new List<Image>();
     var f1 = new Image
     {
         Source =
             Texture._.TypetextureList["Bomb.Normal"],
         VerticalAlignment = VerticalAlignment.Top,
         HorizontalAlignment = HorizontalAlignment.Center,
         Width = 40,
         Height = 40,
         Margin = new Thickness(-430, 4, 0, 0)
     };
     l.Add(f1);
     BombImage.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(0).Id, f1);
     var f2 = new Image
     {
         Source =
             Texture._.TypetextureList["Bomb.Normal"],
         VerticalAlignment = VerticalAlignment.Top,
         HorizontalAlignment = HorizontalAlignment.Center,
         Width = 40,
         Height = 40,
         Margin = new Thickness(-140, 4, 0, 0)
     };
     l.Add(f2);
     BombImage.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(1).Id, f2);
     if (nbplayer > 2)
     {
         var f3 = new Image
         {
             Source =
                 Texture._.TypetextureList["Bomb.Normal"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(240, 4, 0, 0)
         };
         l.Add(f3);
         BombImage.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(2).Id, f3);
     }
     if (nbplayer > 3)
     {
         var f4 = new Image
         {
             Source =
                 Texture._.TypetextureList["Bomb.Normal"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(500, 4, 0, 0)
         };
         l.Add(f4);
         BombImage.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(3).Id, f4);
     }
     return l;
 }
示例#2
0
        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);
        }
示例#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 MainWindow()
 {
     InitializeComponent();
     _gameInProgress = new ClassicGame();
 }
示例#5
0
        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;
            }
        }
示例#6
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
                             )));
                     });
            }
        }
示例#7
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;
            }
        }
示例#8
0
 public void Init()
 {
     _currentGame = _theWindow.GameInProgress;
     _currentScreen = null;
     _theWindow.KeyDown += KeyDown;
     _theWindow.KeyUp += KeyUp;
 }
示例#9
0
        public void InitInGameMenu(Game g)
        {
            if(GameParameters._.Type != GameType.Crazy)
            {
                var nbplayer = g.TheCurrentMap.ListOfPlayer.Count;
                thedisplayedTime = null;
                lifeLabel.Clear();
                thedisplayedTime = InitLabel();
                thedisplayedTime.Margin = new Thickness(0, 4, 0, 0);
                thedisplayedTime.Content = GameParameters._.GameTime;
                var lifejoueur1 = InitLabel();
                lifejoueur1.Margin = new Thickness(-400, 4, 0, 0);
                lifejoueur1.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(0).Lives.ToString();
                lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(0).Id, lifejoueur1);
                var lifejoueur2 = InitLabel();
                lifejoueur2.Margin = new Thickness(-200, 4, 0, 0);
                lifejoueur2.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(1).Lives.ToString();
                lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(1).Id, lifejoueur2);
                if (nbplayer > 2)
                {
                    var lifejoueur3 = InitLabel();
                    lifejoueur3.Margin = new Thickness(300, 4, 0, 0);
                    lifejoueur3.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(2).Lives.ToString();
                    lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(2).Id, lifejoueur3);

                }
                if (nbplayer > 3)
                {
                    var lifejoueur4 = InitLabel();
                    lifejoueur4.Margin = new Thickness(500, 4, 0, 0);
                    lifejoueur4.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(3).Lives.ToString();
                    lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(3).Id, lifejoueur4);

                }
            }else
            {
                cdLabel = new Dictionary<int, Label>();
                var nbplayer = g.TheCurrentMap.ListOfPlayer.Count;
                thedisplayedTime = null;
                lifeLabel.Clear();
                thedisplayedTime = InitLabel();
                thedisplayedTime.Margin = new Thickness(0, 4, 0, 0);
                thedisplayedTime.Content = GameParameters._.GameTime;
                var lifejoueur1 = InitLabel();
                lifejoueur1.Margin = new Thickness(-490, 4, 0, 0);
                lifejoueur1.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(0).Lives.ToString();
                lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(0).Id, lifejoueur1);
                var cdjoueur1 = InitLabelCD();
                cdjoueur1.Margin = new Thickness(-400, 9, 0, 0);
                cdLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(0).Id, cdjoueur1);

                var lifejoueur2 = InitLabel();
                lifejoueur2.Margin = new Thickness(-200, 4, 0, 0);
                lifejoueur2.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(1).Lives.ToString();
                lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(1).Id, lifejoueur2);
                var cdjoueur2 = InitLabelCD();
                cdjoueur2.Margin = new Thickness(-110, 9, 0, 0);
                cdLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(1).Id, cdjoueur2);
                if (nbplayer > 2)
                {
                    var lifejoueur3 = InitLabel();
                    lifejoueur3.Margin = new Thickness(180, 4, 0, 0);
                    lifejoueur3.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(2).Lives.ToString();
                    lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(2).Id, lifejoueur3);
                    var cdjoueur3 = InitLabelCD();
                    cdjoueur3.Margin = new Thickness(270, 9, 0, 0);
                    cdLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(2).Id, cdjoueur3);
                }
                if (nbplayer > 3)
                {
                    var lifejoueur4 = InitLabel();
                    lifejoueur4.Margin = new Thickness(440, 4, 0, 0);
                    lifejoueur4.Content = g.TheCurrentMap.ListOfPlayer.ElementAt(3).Lives.ToString();
                    lifeLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(3).Id, lifejoueur4);
                    var cdjoueur4 = InitLabelCD();
                    cdjoueur4.Margin = new Thickness(530, 9, 0, 0);
                    cdLabel.Add(g.TheCurrentMap.ListOfPlayer.ElementAt(3).Id, cdjoueur4);
                }
                BombImage = new Dictionary<int, Image>();
                BombStack = new Dictionary<int, Image>();

            }
        }
示例#10
0
 public List<Image> AllTheFace(Game g)
 {
     if(GameParameters._.Type != GameType.Crazy)
     {
         var nbplayer = g.TheCurrentMap.ListOfPlayer.Count;
         var l = new List<Image>();
         var f1 = new Image
         {
             Source =
                 Texture._.TypetextureList[
                     "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(0).Skinid + "_down"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(-460, 4, 0, 0)
         };
         l.Add(f1);
         var f2 = new Image
         {
             Source =
                 Texture._.TypetextureList[
                     "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(1).Skinid + "_down"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(-260, 4, 0, 0)
         };
         l.Add(f2);
         if (nbplayer > 2)
         {
             var f3 = new Image
             {
                 Source =
                     Texture._.TypetextureList[
                         "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(2).Skinid + "_down"],
                 VerticalAlignment = VerticalAlignment.Top,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 Width = 40,
                 Height = 40,
                 Margin = new Thickness(240, 4, 0, 0)
             };
             l.Add(f3);
         }
         if (nbplayer > 3)
         {
             var f4 = new Image
             {
                 Source =
                     Texture._.TypetextureList[
                         "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(3).Skinid + "_down"],
                 VerticalAlignment = VerticalAlignment.Top,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 Width = 40,
                 Height = 40,
                 Margin = new Thickness(440, 4, 0, 0)
             };
             l.Add(f4);
         }
         return l;
     }else
     {
         var nbplayer = g.TheCurrentMap.ListOfPlayer.Count;
         var l = new List<Image>();
         var f1 = new Image
         {
             Source =
                 Texture._.TypetextureList[
                     "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(0).Skinid + "_down"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(-550, 4, 0, 0)
         };
         l.Add(f1);
         var f2 = new Image
         {
             Source =
                 Texture._.TypetextureList[
                     "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(1).Skinid + "_down"],
             VerticalAlignment = VerticalAlignment.Top,
             HorizontalAlignment = HorizontalAlignment.Center,
             Width = 40,
             Height = 40,
             Margin = new Thickness(-260, 4, 0, 0)
         };
         l.Add(f2);
         if (nbplayer > 2)
         {
             var f3 = new Image
             {
                 Source =
                     Texture._.TypetextureList[
                         "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(2).Skinid + "_down"],
                 VerticalAlignment = VerticalAlignment.Top,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 Width = 40,
                 Height = 40,
                 Margin = new Thickness(120, 4, 0, 0)
             };
             l.Add(f3);
         }
         if (nbplayer > 3)
         {
             var f4 = new Image
             {
                 Source =
                     Texture._.TypetextureList[
                         "Player_" + g.TheCurrentMap.ListOfPlayer.ElementAt(3).Skinid + "_down"],
                 VerticalAlignment = VerticalAlignment.Top,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 Width = 40,
                 Height = 40,
                 Margin = new Thickness(380, 4, 0, 0)
             };
             l.Add(f4);
         }
         return l;
     }
 }
示例#11
0
 public void PutFlowerLimit(Game g, IEnumerable<Entity> l)
 {
     var theRightDestroyed = this.GiveTheFirst(l, Direction.Right);
     var theTrueRight = theRightDestroyed != null
                            ? new HardBlock(theRightDestroyed.X, theRightDestroyed.Y)
                            : null;
     var theLeftDestroyed = this.GiveTheFirst(l, Direction.Left);
     var theTrueLeft = theLeftDestroyed != null
                            ? new HardBlock(theLeftDestroyed.X, theLeftDestroyed.Y)
                            : null;
     var theUpDestroyed = this.GiveTheFirst(l, Direction.Up);
     var theTrueUp = theUpDestroyed != null
                            ? new HardBlock(theUpDestroyed.X, theUpDestroyed.Y)
                            : null;
     var theDownDestroyed = this.GiveTheFirst(l, Direction.Down);
     var theTrueDown = theDownDestroyed != null
                            ? new HardBlock(theDownDestroyed.X, theDownDestroyed.Y)
                            : null;
     Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => Texture._.ExplosionFlower(this, g, theTrueLeft, theTrueUp, theTrueRight, theTrueDown, null)));
 }
示例#12
0
        public void ExplodeFreeze(Game g)
        {
            PlaySound._.TypeSoundList["Explosionwav"].Play();
            g.TheCurrentMap.ListOfBomb.Remove(this);
            var thecompletelist = g.TheCurrentMap.GetCompleteList(true, true);
            thecompletelist.AddRange(g.TheCurrentMap.ListOfEntityOfDeath.Where(c => c != null && c.Blocus));
            Texture._.DeleteTextureEntity(this);

            var l = thecompletelist.Where(c => (this.Y == c.Y && (c.X <= (this.X + this.Power) && (c.X >= (this.X - this.Power)))) || (this.X == c.X && (c.Y <= (this.Y + this.Power) && (c.Y >= (this.Y - this.Power)))));
            var theRightDestroyed = this.GiveTheFirst(l, Direction.Right);
            var theLeftDestroyed = this.GiveTheFirst(l, Direction.Left);
            var theUpDestroyed = this.GiveTheFirst(l, Direction.Up);
            var theDownDestroyed = this.GiveTheFirst(l, Direction.Down);
            var theNoneDestroyed = this.GiveTheFirst(l, Direction.None);
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => Texture._.ExplosionFreeze(this, g, theLeftDestroyed, theUpDestroyed, theRightDestroyed, theDownDestroyed, theNoneDestroyed)));

            //foreach (var e in toBeDestroyed)
            //{
            //    if (e is Bomb)
            //    {
            //        var theBomb = g.TheCurrentMap.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y);
            //        theBomb.Explode(g);
            //    }
            //}
            //g.ToDelete.AddRange(toBeDestroyed.FindAll(e => !(e is Bomb)));
            //if (!g.ToDelete.Contains(this))
            //{
            //    g.ToDelete.Add(this);
            //}
            Owner.BombExploded(this);
        }
示例#13
0
        public void ExplodeCata(Game g)
        {
            PlaySound._.TypeSoundList["Explosionwav"].Play();
            g.TheCurrentMap.ListOfBomb.Remove(this);
            var thecompletelist = g.TheCurrentMap.GetCompleteList(true, true);
            thecompletelist.AddRange(g.TheCurrentMap.ListOfEntityOfDeath.Where(c => c != null && c.Blocus));
            Texture._.DeleteTextureEntity(this);
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => CheckDestroyed(g)));

            //foreach (var e in toBeDestroyed)
            //{
            //    if (e is Bomb)
            //    {
            //        var theBomb = g.TheCurrentMap.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y);
            //        theBomb.Explode(g);
            //    }
            //}
            //g.ToDelete.AddRange(toBeDestroyed.FindAll(e => !(e is Bomb)));
            //if (!g.ToDelete.Contains(this))
            //{
            //    g.ToDelete.Add(this);
            //}
            Owner.BombExploded(this);
        }
示例#14
0
        public EntityOfDeath(int x, int y, Game g, Player o, bool b = false, int mod = 0)
            : base(x, y)
        {
            thereIsOne = false;
            blocus = b;
            hurt = true;
            G = g;
            owner = o;
            mode = mod;
            if (G.TheCurrentMap.GetEntityOfDeath(x,y) == null || (G.TheCurrentMap.GetEntityOfDeath(x,y) != null && !G.TheCurrentMap.GetEntityOfDeath(x,y).Blocus))
            {
                if(G.TheCurrentMap.GetEntityOfDeath(x,y) != null)
                {
                    try
                    {
                        G.TheCurrentMap.ListOfEntityOfDeath.Remove(G.TheCurrentMap.GetEntityOfDeath(x, y));
                    }catch(Exception e)
                    {

                    }
                }
                G.TheCurrentMap.ListOfEntityOfDeath.Add(this);
                var listEntity = new List<Entity>();
                listEntity.AddRange(G.TheCurrentMap.GetCompleteList());
                foreach (var e in listEntity.Where(play => play.X == x && play.Y == y))
                {
                    if (e is Bomb)
                    {
                        var bt = (Bomb) e;
                        if(GameParameters._.Type == GameType.Classic)
                        {
                            var theBomb = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                            if (theBomb != null) theBomb.Explode(G);
                        }else
                        if(bt.Type != BombType.Mine)
                        {
                            switch (bt.Type)
                            {
                                case BombType.Normal:
                                    var theBomb = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb != null) theBomb.Explode(G);
                                    break;
                                case BombType.Teleguide:
                                    var theBomb7 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb7 != null)
                                    {
                                        theBomb7.Owner.MyBombTeleguide = null;
                                        theBomb7.Owner.beAvaliableLag();
                                        theBomb7.Explode(G);
                                    }
                                    break;
                                case BombType.Cataclysm:
                                    var theBomb2 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb2 != null) theBomb2.ExplodeCata(G);
                                    break;
                                case BombType.Flower:
                                    var theBomb3 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb3 != null) theBomb3.ExplodeFlower(G);
                                    break;
                                case BombType.Freeze:
                                    var theBomb4 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb4 != null) theBomb4.ExplodeFreeze(G);
                                    break;
                                case BombType.Dark:
                                    var theBomb6 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb6 != null) theBomb6.ExplodeDark(G);
                                    break;
                                default:
                                    var theBomb5 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb5 != null) theBomb5.Explode(G);
                                    break;
                            }

                        }

                    }
                    else
                        if (e is SoftBlock)
                        {
                            var theSoftBlock = G.TheCurrentMap.ListOfSoftBlock.First(c => c.X == e.X && c.Y == e.Y);
                            theSoftBlock.Destroy(G.TheCurrentMap);
                            G.TheCurrentMap.ListOfSoftBlock.Remove(theSoftBlock);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is Upgrade)
                        {
                            var theUpgrade = G.TheCurrentMap.ListOfUpgrade.First(c => c.X == e.X && c.Y == e.Y);
                            theUpgrade.Burn();
                            G.TheCurrentMap.ListOfUpgrade.Remove(theUpgrade);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is UpgradeBomb)
                        {
                            var theUpgradeBomb = G.TheCurrentMap.ListOfUpgradeBomb.First(c => c.X == e.X && c.Y == e.Y);
                            theUpgradeBomb.Burn();
                            G.TheCurrentMap.ListOfUpgradeBomb.Remove(theUpgradeBomb);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is Player)
                        {
                            if(mode == 0)
                            {
                                var play = (Player)e;
                                if (!(play.Invincible))
                                {
                                    Score._.KilledBy(owner, play);
                                    if (play.Die())
                                    {
                                        var thePlayer = G.TheCurrentMap.ListOfPlayer.FirstOrDefault(c => c.X == play.X && c.Y == play.Y);
                                        if (thePlayer != null)
                                        {
                                            G.TheCurrentMap.ListOfPlayer.Remove(thePlayer);
                                            Texture._.DeleteTextureEntity(thePlayer);
                                            thereIsOne = true;
                                        }
                                    }
                                    else
                                    {
                                        play.cling();
                                    }
                                }
                            }
                            else if (mode == 1)
                            {
                                var play = (Player)e;
                                if (e != null)
                                {
                                    play.freezePlayer();
                                }
                            }
                            else if (mode == 2)
                            {
                                var play = (Player)e;
                                if (e != null)
                                {
                                    play.cursePlayer();
                                }
                            }

                        }
                }
                if (thereIsOne)
                {
                    G.TheCurrentMap.CheckForAllDead();
                }
            }
            TimerManager._.AddNewTimer(false, 500, true, null, SupressBlocus);
            TimerManager._.AddNewTimer(false, 700, true, null, Supress);
        }