本文整理汇总了C#中Cell.GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.GetTexture方法的具体用法?C# Cell.GetTexture怎么用?C# Cell.GetTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cell
的用法示例。
在下文中一共展示了Cell.GetTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTileBrush
public Brush GetTileBrush(Cell cell, Point localTileID)
{
var texture = cell.GetTexture();
if (!texture) throw new UnityException("Texture is missing");
var index = localTileID.Y*TilesPerCell + localTileID.X;
var tile = cell.GetTile(index);
var colors = texture.GetPixels(localTileID.X*TileResolution, localTileID.Y*TileResolution, TileResolution,
TileResolution);
var c = tile.Collision;
var collision = new bool[c.Length];
Array.Copy(c, collision, c.Length);
return new Brush(colors, new TileProperties(tile.Properties), collision);
}
示例2: ChangeTile
public Texture2D ChangeTile(Cell cell, Point localTileID, Brush data)
{
var index = localTileID.Y*_tilerMap.TilesPerCell + localTileID.X;
var t = cell.GetTile(index);
if (t.Properties != data.Properties)
{
var oldBrush = _tilerMap.GetTileBrush(cell, localTileID);
Undo.PushUndo(cell, localTileID, oldBrush);
t.Properties = new TileProperties(data.Properties);
var texture = cell.GetTexture();
if (!texture)
return null;
texture.SetPixels(localTileID.X*_tilerMap.TileResolution, localTileID.Y*_tilerMap.TileResolution, _tilerMap.TileResolution,
_tilerMap.TileResolution, data.Colors);
var c = data.Collision;
var collision = new bool[c.Length];
Array.Copy(c, collision, c.Length);
t.Collision = collision;
// Just add to apply list so we don't run multiple applies for same texture
cell.IsDirty = true;
return texture;
}
return null;
}