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


C# Camera.GetScreenHeight方法代码示例

本文整理汇总了C#中UnityEngine.Camera.GetScreenHeight方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.GetScreenHeight方法的具体用法?C# Camera.GetScreenHeight怎么用?C# Camera.GetScreenHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Camera的用法示例。


在下文中一共展示了Camera.GetScreenHeight方法的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;
 }
开发者ID:Kennyomg,项目名称:fairwinds,代码行数:9,代码来源:GameSettings.cs

示例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;
    }
开发者ID:phoenixtail26,项目名称:Platformer,代码行数:45,代码来源:LOD.cs


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