本文整理汇总了C#中Tile.DefineTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.DefineTexture方法的具体用法?C# Tile.DefineTexture怎么用?C# Tile.DefineTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.DefineTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBrush
private void CreateBrush()
{
GameWorld gameWorld = GameWorld.Instance;
SelectedIndexes = GetTilesCoveredByBrush();
// Create grid.
Tile hoveredTile = gameWorld.TileArray[SelectedIndexes[0]];
hoverBrushSquare.Rectangle = new Rectangle(hoveredTile.GetDrawRectangle().X, hoveredTile.GetDrawRectangle().Y, Size * (int)hoveredTile.GetSize().X * Main.Tilesize, Size * (int)hoveredTile.GetSize().Y * Main.Tilesize);
hoverBrushSquare.SourceRectangle = new Rectangle(21 * 16, 7 * 16, 16, 16);
hoverBrushSquare.Texture = GameWorld.SpriteSheet;
for (int i = 0; i < _selectedBrushTiles.Length; i++)
{
if (SelectedIndexes[i] >= 0 && SelectedIndexes[i] < gameWorld.TileArray.Length)
{
//Create transparent tiles to show selected tile
hoveredTile = gameWorld.TileArray[SelectedIndexes[i]];
Tile fakeTile = new Tile(true);
fakeTile.Id = gameWorld.LevelEditor.SelectedId;
fakeTile.DrawRectangle = hoveredTile.DrawRectangle;
fakeTile.IsBrushTile = true;
fakeTile.DefineTexture();
fakeTile.Texture = GameWorld.SpriteSheet;
_selectedBrushTiles[i] = fakeTile;
}
}
}
示例2: Load
public void Load()
{
Tiles = new List<Tile>();
Names = new List<TileName>();
foreach (byte id in CurrentAvailableTileSet)
{
Tile tile = new Tile(true);
tile.Id = id;
tile.DefineTexture();
tile.DrawRectangle = new Rectangle(ActiveX, (int)((Main.Tilesize / Main.HeightRatio) * Tiles.Count), (int)(Main.Tilesize/ Main.HeightRatio), (int)(Main.Tilesize / Main.HeightRatio));
Tiles.Add(tile);
TileName tileName = new TileName();
Tile.Names.TryGetValue(tile.Id, out tileName.Name);
if (tileName.Name == null) tileName.Name = "*";
tileName.Position = new Vector2((float)(ActiveX) + 5, tile.DrawRectangle.Center.Y - Font.LineSpacing / 2);
Names.Add(tileName);
}
Hide();
}