本文整理汇总了C#中Grid.PixelAtCell方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.PixelAtCell方法的具体用法?C# Grid.PixelAtCell怎么用?C# Grid.PixelAtCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid
的用法示例。
在下文中一共展示了Grid.PixelAtCell方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PixelsAtCellZeroAreEqualToOffsetWhenOffsetIsNotZero
public void PixelsAtCellZeroAreEqualToOffsetWhenOffsetIsNotZero()
{
grid = new Grid(8, 8) {
HorizontalOffset = 50f,
VerticalOffset = 32f
};
Assert.That(grid.PixelAtCell(0, 0), Is.EqualTo(new Vector2(grid.HorizontalOffset, grid.VerticalOffset)));
}
示例2: PixelOffsetsAreZeroWhenNotSet
public void PixelOffsetsAreZeroWhenNotSet()
{
int gridWidth = 8;
int gridHeight = 5;
int zeroHorizontalOffset = 0, zeroVerticalOffset = 0;
grid = new Grid(gridWidth, gridHeight);
int i = 3;
int j = 4;
float width = zeroHorizontalOffset + gridWidth * i;
float height = zeroVerticalOffset + gridHeight * j;
Assert.That(grid.PixelAtCell(i, j), Is.EqualTo(new Vector2(width, height)));
}
示例3: PixelWidthAndHeightEqualToOffsetPlusCellSize
public void PixelWidthAndHeightEqualToOffsetPlusCellSize()
{
int gridWidth = 8;
int gridHeight = 5;
grid = new Grid(gridWidth, gridHeight) {
HorizontalOffset = 50f,
VerticalOffset = 32f
};
int i = 3;
int j = 4;
float width = grid.HorizontalOffset + gridWidth * i;
float height = grid.VerticalOffset + gridHeight * j;
Assert.That(grid.PixelAtCell(i, j), Is.EqualTo(new Vector2(width, height)));
}
示例4: SetUVToGridCell
public void SetUVToGridCell(Grid grid, int i, int j)
{
// show only the rectangle at the (i, j) grid coordinate on this mesh
var textureWidth = material.mainTexture.width;
var textureHeight = material.mainTexture.height;
var corner = grid.PixelAtCell(i, j);
var cellAsUV = new Rect(corner.x / textureWidth, corner.y / textureHeight,
grid.cellWidth / textureWidth, grid.cellHeight / textureHeight);
Vector2[] uvs = new Vector2[4];
uvs[0] = new Vector2(cellAsUV.xMax, cellAsUV.yMax);
uvs[1] = new Vector2(cellAsUV.xMin, cellAsUV.yMax);
uvs[2] = new Vector2(cellAsUV.xMax, cellAsUV.yMin);
uvs[3] = new Vector2(cellAsUV.xMin, cellAsUV.yMin);
mesh.uv = uvs;
}
示例5: PixelsAtCellZeroAreZeroVector
public void PixelsAtCellZeroAreZeroVector()
{
grid = new Grid(8, 8);
Assert.That(grid.PixelAtCell(0, 0), Is.EqualTo(Vector2.zero));
}