当前位置: 首页>>代码示例>>C#>>正文


C# Grid.PixelAtCell方法代码示例

本文整理汇总了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)));
 }
开发者ID:absurdhero,项目名称:tmotmo-full,代码行数:8,代码来源:TestGrid.cs

示例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)));
        }
开发者ID:absurdhero,项目名称:tmotmo-full,代码行数:13,代码来源:TestGrid.cs

示例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)));
        }
开发者ID:absurdhero,项目名称:tmotmo-full,代码行数:15,代码来源:TestGrid.cs

示例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;
    }
开发者ID:absurdhero,项目名称:tmotmo-full,代码行数:19,代码来源:ImageMaterial.cs

示例5: PixelsAtCellZeroAreZeroVector

 public void PixelsAtCellZeroAreZeroVector()
 {
     grid = new Grid(8, 8);
     Assert.That(grid.PixelAtCell(0, 0), Is.EqualTo(Vector2.zero));
 }
开发者ID:absurdhero,项目名称:tmotmo-full,代码行数:5,代码来源:TestGrid.cs


注:本文中的Grid.PixelAtCell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。