public bool IsInCircle(ObjectPosition other, float radius) { float xDistance = this.X - other.X; float zDistance = this.Z - other.Z; return((Math.Pow(xDistance, 2) + Math.Pow(zDistance, 2)) <= Math.Pow(radius, 2)); }
public bool IsInRange(ObjectPosition to, int range) { float distance = DistanceTo(to); return(distance <= Math.Pow(range, 2)); }
public bool IsInRange(ObjectPosition to, int range) { return(DistanceTo(to) <= range); }
public float DistanceTo(ObjectPosition to) { return((float)(Math.Pow(this.X - to.X, 2) + Math.Pow(this.Y - to.Y, 2) + Math.Pow(this.Z - to.Z, 2))); }
public float DistanceTo(ObjectPosition to) { return(Convert.ToSingle(Math.Abs(Math.Sqrt(Math.Pow(this.X - to.X, 2) + Math.Pow(this.Y - to.Y, 2) + Math.Pow(this.Z - to.Z, 2))))); }