/// <summary> /// Called by the button combo class when the player has made a combo thing /// </summary> public void onComboButtonPressed() { // check if there are any peons nearby and notify them foreach (Peon p in Engine.manager.Peons) { if (boundingCircle.intersects(p.BoundingCircle)) { p.onNearbyCombo(this); } } }
public Vector2 avoidCircle(BoundingCircle me, BoundingCircle circle) { Debug.Assert(position == me.Position); if (me.intersects(circle)) { // calculate the direction we need to move to resolve the collision Vector2 dir = Vector2.Normalize(me.Position - circle.Position); // scale the direction by the amount we intersect the circle dir *= (me.Radius + circle.Radius) - Vector2.Distance(position, circle.Position); return(dir); } return(Vector2.Zero); }