本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}