/// <summary> /// Check wether this track Item is closest to the mouse location /// </summary> /// <param name="location">Location to check</param> /// <param name="mouseLocation">Current mouse location</param> /// <param name="trItem">The track Item that will be stored when it is indeed the closest</param> public void CheckMouseDistance(WorldLocation location, WorldLocation mouseLocation, DrawableTrackItem trItem) { float distanceSquared = CloseToMouse.GetGroundDistanceSquared(location, mouseLocation); if (distanceSquared < ClosestDistanceSquared) { ClosestDistanceSquared = distanceSquared; this.DrawableTrackItem = trItem; this.worldLocation = location; this.Description = trItem.Description; } }
/// <summary> /// Return whether this item is closer than the other item. /// </summary> /// <param name="otherItem">The other item to compare to</param> /// <returns></returns> public bool IsCloserThan(CloseToMouse otherItem) { return(this.ClosestMouseDistanceSquared < otherItem.ClosestMouseDistanceSquared); }