Ejemplo n.º 1
0
        public void Initialize(int width, int height, int typesOfTrash)
        {
            Width        = width;
            Height       = height;
            TypesOfTrash = typesOfTrash;

            float tileWidth  = (float)this.Collision.Region().Width / width;
            float tileHeight = (float)this.Collision.Region().Height / height;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    Vector2       position  = new Vector2(this.Collision.Position.X + tileWidth * x, this.Collision.Position.Y + tileHeight * y);
                    Vector2       size      = new Vector2(tileWidth, tileHeight);
                    RectangleBody collision = new RectangleBody(position, size);

                    Trash newTrash = new Trash(this.Game, collision, rand.Next() % typesOfTrash);
                    TrashTiles.Add(newTrash);
                }
            }

            RectangleBody rect = new RectangleBody(new Vector2(0, 0), new Vector2(tileWidth * Config.SELECTION_WIDTH, tileHeight * Config.SELECTION_HEIGHT));

            Selection = new Selection(Game, rect);

            ScrambleBoard();
        }
Ejemplo n.º 2
0
 public void FlipTile(Trash trash)
 {
     trash.Flip();
 }