public void AttemptToSetNewClosestGravityField(Attractor potentialClosest, float distance) { if (_closest == null) { _closest = potentialClosest; _nearestSqrDistanceFound = distance; return; } if (distance < _nearestSqrDistanceFound) { _closest = potentialClosest; _nearestSqrDistanceFound = distance; } }
public void RemoveGravityAction(Attractor gravityField) { _attractorApplyingForce.Remove(gravityField); }
public void AddGravityAction(Attractor gravityField) { _attractorApplyingForce.AddIfNotContain(gravityField); }
/// <summary> /// return true if this GravityFieldAction is actually the closest one to the player /// </summary> public bool IsTheValidOneInTheGroup(Attractor toTest) { return(toTest == _closest); }
public void ResetGroup() { _closest = null; }