本文整理汇总了C#中Quad.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Quad.Contains方法的具体用法?C# Quad.Contains怎么用?C# Quad.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad
的用法示例。
在下文中一共展示了Quad.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMask
public void CreateMask(Quad frame)
{
Logger.Log("Erstelle Pixelmaske.");
// create a new texture that is fullscreen sized
if (texture != null)
Object.DestroyImmediate(texture);
texture = new Texture2D(Screen.width, Screen.height);
// get pixel array (better performance)
Color[] pixels = texture.GetPixels();
// set all pixels to black.
// set pixels that are inside the frame to transparent
for (int x = 0; x < texture.width; x++)
{
for (int y = 0; y < texture.height; y++)
{
int pos = (y * texture.width) + x;
pixels[pos] = Color.black;
// pixels[pos].a = 1;
Vector2 position = new Vector2((float)x / Screen.width, (float)y / Screen.height);
if (frame.Contains(position))
{
pixels[pos].a = 0;
}
}
}
// upload texture to vram
texture.SetPixels(pixels);
texture.Apply();
// adjust the texture size and assign texture to GUITexture component
guiTexture.pixelInset = new Rect(0, 0, texture.width, texture.height);
guiTexture.texture = texture;
gameObject.SetActive(true);
}