Ejemplo n.º 1
0
 public void SetInMap(Entity entity, int x, int y)
 {
     int[] mapLength = Lenght();
     if (0 <= x && x < mapLength[0] && 0 <= y && y < mapLength[1])
     {
         if (!(MapGame[x][y] is Bullet || MapGame[x][y] is Wall))
         {
             if (MapGame[x][y] != null)
             {
                 IControlable.Kill();
                 MapGame[x][y] = null;
             }
             else
             {
                 MapGame[x][y] = entity;
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void Replacebullet(List <Bullet> l)
        {
            bool ko;

            foreach (Bullet bul in l)
            {
                ko = false;

                if (!(MapGame[bul.X][bul.Y] is Wall))
                {
                    if (MapGame[bul.X][bul.Y] != null)
                    {
                        ko = true;
                    }

                    MapGame[bul.X][bul.Y] = null;
                    if (ko)
                    {
                        IControlable.Kill();
                    }

                    else if (bul.Y - 1 >= 0 && !(MapGame[bul.X][bul.Y - 1] is Wall))
                    {
                        if (MapGame[bul.X][bul.Y - 1] != null)
                        {
                            MapGame[bul.X][bul.Y - 1] = null;
                            IControlable.Kill();
                        }
                        else
                        {
                            MapGame[bul.X][bul.Y - 1] = bul;
                            bul.Y--;
                        }
                    }
                }
            }
        }