예제 #1
0
        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));
        }
예제 #2
0
        public bool IsInRange(ObjectPosition to, int range)
        {
            float distance = DistanceTo(to);

            return(distance <= Math.Pow(range, 2));
        }
예제 #3
0
 public bool IsInRange(ObjectPosition to, int range)
 {
     return(DistanceTo(to) <= range);
 }
예제 #4
0
 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)));
 }
예제 #5
0
 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)))));
 }