Example #1
0
 public void Explode(bool explodeType)
 {
     _isExploded = explodeType;
     for (int x = -1; x <= 1; x++)
     {
         for (int y = -1; y <= 1; y++)
         {
             var          cellLoc = new Vector(Loc.X + x, Loc.Y + y);
             MovingEntity expEntity;
             Model.MovingEntities.TryGetValue(cellLoc, out expEntity);
             if (cellLoc.Get(Model.Data) != null)
             {
                 var expCell  = Model.Data[cellLoc.Y][cellLoc.X];
                 var lastType = expCell.TypeOfCell;
                 expCell.TypeOfCell         = explodeType? CellType.Explosing: CellType.None;
                 expCell.MovingAnimationDir = "";
                 expCell.ToBeFilled         = false;
                 if (!explodeType)//adding neighbours after the call
                 {
                     CreateEntity(Model, cellLoc).AddUpperEntities();
                 }
                 if (lastType == CellType.Murphy)
                 {
                     Model.GameFinishing(false);
                 }
                 if (expEntity == null)
                 {
                     continue;
                 }
                 expEntity.NextLoc = expEntity.Loc;
                 if (!explodeType)
                 {
                     Model.MovingEntities.Remove(Loc);
                 }
             }
         }
     }
 }