本文整理汇总了C#中UnityEngine.Camera.GetScreenWidth方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.GetScreenWidth方法的具体用法?C# Camera.GetScreenWidth怎么用?C# Camera.GetScreenWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Camera
的用法示例。
在下文中一共展示了Camera.GetScreenWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetBackgroundResolution
public void SetBackgroundResolution(Camera mainCamera, GUITexture myGUITexture)
{
Rect temp = myGUITexture.pixelInset;
temp.height = mainCamera.GetScreenHeight();
temp.width = mainCamera.GetScreenWidth();
temp.y = -(mainCamera.GetScreenHeight()/2);
temp.x = -(mainCamera.GetScreenWidth()/2);
myGUITexture.pixelInset = temp;
}
示例2: RecalcLOD
public void RecalcLOD( Camera cam )
{
if ( !_started )
{
Start();
}
boundsMin = boundsCenter - _bounds.extents;
boundsMax = boundsCenter + _bounds.extents;
boundsMin = _transform.TransformPoint(boundsMin);
boundsMax = _transform.TransformPoint(boundsMax);
Vector3 screenMin = cam.WorldToScreenPoint(boundsMin);
Vector3 screenMax = cam.WorldToScreenPoint(boundsMax);
Vector3 diff = screenMax - screenMin;
float heightPerc = Mathf.Abs(diff.y) / cam.GetScreenHeight();
float widthPerc = Mathf.Abs(diff.x) / cam.GetScreenWidth();
percentageSizeOnScreen = heightPerc > widthPerc ? heightPerc : widthPerc;
LODLevel newLevel = LODLevel.LOD0;
if ( percentageSizeOnScreen >= _LODSizes[2] )
{
newLevel = LODLevel.LOD0;
}
else if ( percentageSizeOnScreen >= _LODSizes[1] )
{
newLevel = LODLevel.LOD1;
}
else if ( percentageSizeOnScreen >= _LODSizes[0] )
{
newLevel = LODLevel.LOD2;
}
else
{
newLevel = LODLevel.LODCulled;
}
newLevel = EnableLODRenderers(newLevel);
level = newLevel;
}