本文整理汇总了C#中Rect.IsContainsPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.IsContainsPoint方法的具体用法?C# Rect.IsContainsPoint怎么用?C# Rect.IsContainsPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect.IsContainsPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWaterPlaneSplash
private void CreateWaterPlaneSplash()
{
float influenceRadius = Type.Radius * .75f;
foreach (WaterPlane waterPlane in WaterPlane.Instances)
{
//check by height
if (Position.Z + influenceRadius < waterPlane.Position.Z)
continue;
if (Position.Z - influenceRadius > waterPlane.Position.Z)
continue;
//check by bounds
Rect bounds2 = new Rect(waterPlane.Position.ToVec2());
bounds2.Expand(waterPlane.Size * .5f);
if (!bounds2.IsContainsPoint(Position.ToVec2()))
continue;
//check by physics
float height = Position.Z + .01f;
float waterHeight = waterPlane.Position.Z;
Ray ray = new Ray(new Vec3(Position.X, Position.Y, height),
new Vec3(0, 0, waterHeight - height));
if (ray.Direction.Z != 0)
{
RayCastResult result = PhysicsWorld.Instance.RayCast(
ray, (int)ContactGroup.CastOnlyContact);
if (result.Shape != null)
continue;
}
//create splash
waterPlane.CreateSplash(WaterPlaneType.SplashTypes.Explosion,
new Vec3(Position.X, Position.Y, waterPlane.Position.Z));
}
}