public void OnCollision(BoneAnimator other, Bone bone, Bone otherBone) { bone.Blend = Color.Red; /*entityAttach.OnCollision(new CollisionData * { * Other = other.Entity, * Position = new Vector3((bone.Position + otherBone.Position) / 2.0f, 0.0f), * Angle = (float)Math.Atan2((double)(otherBone.Position.X - bone.Position.X), (double)(otherBone.Position.Y - bone.Position.Y)), * MyBone = bone, * OtherBone = otherBone * } * );*/ }
public bool CheckCollisions(BoneAnimator other) { foreach (Bone a in this.Bones) { foreach (Bone b in other.Bones) { //if (Collision2D.CheckPerPixel(TextureStatic.Get(a.Texture), TextureStatic.Get(b.Texture), a.Position, b.Position, a.Origin, b.Origin, a.BoundingRect, b.BoundingRect, a.Angle, b.Angle)) if (Collision2D.CheckRectangles(a.BoundingRect, b.BoundingRect)) { this.OnCollision(other, b, a); other.OnCollision(this, a, b); } } } return(false); }