Beispiel #1
0
        public void AddSubTile(SubTile subTile, int i, int j)
        {
            Tile tile = TileGrid[i, j];

            tile.TryAddSubtile(subTile);

            ImportantTiles.Add(tile);
            UpdateWorldRender();
        }
Beispiel #2
0
 public void TryAddSubtile(SubTile subTile)
 {
     for (int i = 0; i < 2; i++)
     {
         for (int j = 0; j < 2; j++)
         {
             if (GetSubTileBounds(i, j).Contains(InputManager.MouseScreenPosition))
             {
                 SubTiles[i, j] = subTile;
                 return;
             }
         }
     }
 }
Beispiel #3
0
        public void Draw(SpriteBatch spriteBatch, Vector2 position)
        {
            spriteBatch.Draw(Texture, position, Color.White);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    SubTile subTile = SubTiles[i, j];

                    if (subTile != null)
                    {
                        subTile.Draw(spriteBatch, position + new Vector2(i * SubTile.WIDTH, j * SubTile.HEIGHT));
                    }
                }
            }
        }
Beispiel #4
0
 protected Tile(Texture2D texture, TileCoordinates coords)
 {
     Texture     = texture;
     Coordinates = coords;
     SubTiles    = new SubTile[2, 2];
 }