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


C# ICamera2D.InView方法代码示例

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


在下文中一共展示了ICamera2D.InView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleDrawBuffer

        /// <summary>
        /// When overridden in the derived class, handles drawing to the buffer.
        /// </summary>
        /// <param name="rt">The <see cref="RenderTarget"/> to draw to.</param>
        /// <param name="sb">The <see cref="ISpriteBatch"/> to use to draw to the <paramref name="rt"/>. The derived class
        /// is required to handle making Begin()/End() calls on it.</param>
        /// <param name="camera">The <see cref="ICamera2D"/> to use when drawing.</param>
        /// <returns>True if the drawing was successful; false if there were any errors while drawing.</returns>
        protected override bool HandleDrawBuffer(RenderTarget rt, ISpriteBatch sb, ICamera2D camera)
        {
            // Draw the lights
            sb.Begin(BlendMode.Add, camera);

            foreach (var light in this)
            {
                if (camera.InView(light))
                    light.Draw(sb);
            }

            sb.End();

            return true;
        }
开发者ID:Vizzini,项目名称:netgore,代码行数:23,代码来源:LightManager.cs

示例2: InView

 /// <summary>
 /// Checks if in the object is in view of the specified <paramref name="camera"/>.
 /// </summary>
 /// <param name="camera">The <see cref="ICamera2D"/> to check if this object is in view of.</param>
 /// <returns>
 /// True if the object is in view of the camera, else False.
 /// </returns>
 public bool InView(ICamera2D camera)
 {
     return camera.InView(this);
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:11,代码来源:ItemEntity.cs

示例3: InView

 /// <summary>
 /// Checks if in the object is in view of the specified <paramref name="camera"/>.
 /// </summary>
 /// <param name="camera">The <see cref="ICamera2D"/> to check if this object is in view of.</param>
 /// <returns>
 /// True if the object is in view of the camera, else False.
 /// </returns>
 public bool InView(ICamera2D camera)
 {
     return camera.InView(_grh, Position);
 }
开发者ID:wtfcolt,项目名称:game,代码行数:11,代码来源:MapGrh.cs

示例4: InView

        /// <summary>
        /// Checks if in the object is in view of the specified <paramref name="camera"/>.
        /// </summary>
        /// <param name="camera">The <see cref="ICamera2D"/> to check if this object is in view of.</param>
        /// <returns>True if the object is in view of the camera, else False.</returns>
        public bool InView(ICamera2D camera)
        {
            // Check if in view by using the _min/_maxParticlePosition
            
            // If both are equal to 0, then it probably has not been updated yet, so return true to be safe
            if (_minParticlePosition == Vector2.Zero && _maxParticlePosition == Vector2.Zero)
                return true;

            // Create a rect of the world position covering the area
            Vector2 ownerPos = Owner.Position;
            Vector2 min = _minParticlePosition + ownerPos;
            Vector2 max = _maxParticlePosition + ownerPos;
            Vector2 size = max - min;
            Rectangle rect = new Rectangle(min.X, min.Y, size.X, size.Y);

            // Inflact the rect's size to cover more area, just to be safe
            rect.Inflate(96);

            return camera.InView(rect);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:25,代码来源:ParticleEmitter.cs


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