本文整理汇总了C#中ShapeCollection.CollideAgainstBounceWithoutSnag方法的典型用法代码示例。如果您正苦于以下问题:C# ShapeCollection.CollideAgainstBounceWithoutSnag方法的具体用法?C# ShapeCollection.CollideAgainstBounceWithoutSnag怎么用?C# ShapeCollection.CollideAgainstBounceWithoutSnag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeCollection
的用法示例。
在下文中一共展示了ShapeCollection.CollideAgainstBounceWithoutSnag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CollideAgainst
public void CollideAgainst(ShapeCollection shapeCollection, bool isCloudCollision)
{
CollideAgainst(() => shapeCollection.CollideAgainstBounceWithoutSnag(this.Collision, 0), isCloudCollision);
}
示例2: CollideAgainst
public void CollideAgainst(ShapeCollection shapeCollection, bool isCloudCollision)
{
Vector3 lastPosition = this.Position;
Vector3 lastVelocity = this.Velocity;
float lastY = this.Y;
mIsOnGround = false;
mHitHead = false;
if(shapeCollection.CollideAgainstBounceWithoutSnag(this.Collision, 0))
{
bool wasJumpCancelled = false;
if (isCloudCollision)
{
// Cloud can't modify X and XVelocity
this.X = lastPosition.X;
this.Velocity.X = lastVelocity.X;
Vector3 change = this.Position - lastPosition;
if (change.LengthSquared() > MaximumCloudRepositionLength * MaximumCloudRepositionLength || change.Y <= 0 || lastVelocity.Y > 0)
{
// We only want to do cloud collision, but we didn't fall within the cloud criteria, so let's ignore the collision
this.Position = lastPosition;
this.Velocity = lastVelocity;
wasJumpCancelled = true;
}
// Since we may have repositioned this, we want to reposition the rect for future collisions and for
// rendering.
this.Collision.ForceUpdateDependencies();
}
if (!wasJumpCancelled)
{
if (this.Y > lastY)
{
mIsOnGround = true;
}
if (this.Y < lastY)
{
mHitHead = true;
}
}
}
}