// As above, using the other object's boundingRadius public bool IsTouching(VisibleObject other) { return(IsTouching(other, other.boundingRadius)); }
public MessageNotifyCloseToObject(VisibleObject closeToObject) { this.closeToObject = closeToObject; }
// Return true if this object is in collision with a VisibleObject bounded by // a specified radius. Note that a VisibleObject's coordinates are defined // starting from the upper left corner of the object, so its bounding // radius must be added to both X and Y coordinates to obtain the centre // of the object. public bool IsTouching(VisibleObject other, int radius) { return(IsTouching(other.X, other.Y, other.BoundingRadius, radius)); }
protected virtual void NotifyBumped(VisibleObject bumpedObject) { }
public virtual void NotifyCloseToObject(VisibleObject objectCloseBy) { }
protected override void NotifyBumped(VisibleObject bumpedObject) { Speed = 0; base.NotifyBumped(bumpedObject); }
private void DoNotifyBumped(VisibleObject touchingObject) { SendMessage(new MessageNotifyBumped(touchingObject)); touchingObject.SendMessage(new MessageNotifyBumped(this)); }