public double GetDistance2D(WowObject other) { if (other is WowItem || this is WowItem) throw new InvalidOperationException("Cannot calculate distance between WowItems."); var pos1 = this.MovementData.Position; var pos2 = other.MovementData.Position; var d_x = (double)(pos1.X - pos2.X); var d_y = (double)(pos1.Y - pos2.Y); return Math.Sqrt(d_x * d_x + d_y * d_y); }
public double GetDistance2D(WowObject other) { if (other is WowItem || this is WowItem) { throw new InvalidOperationException("Cannot calculate distance between WowItems."); } var pos1 = this.MovementData.Position; var pos2 = other.MovementData.Position; var d_x = (double)(pos1.X - pos2.X); var d_y = (double)(pos1.Y - pos2.Y); return(Math.Sqrt(d_x * d_x + d_y * d_y)); }