Beispiel #1
0
        public float GetDistance(Position point)
        {
            float x = point.X - X;
            float y = point.Y - Y;
            float z = point.Z - Z;
            float dist = ((x * x) + (y * y)) + (z * z);

            return (float)Math.Sqrt(dist);
        }
Beispiel #2
0
        public static Position operator -(Position a, Position b)
        {
            Position vector = new Position();
            vector.X = (float)(a.X - b.X);
            vector.Y = (float)(a.Y - b.Y);
            vector.Z = (float)(a.Z - b.Z);

            return vector;
        }
Beispiel #3
0
        public static Position operator *(Position a, float scaleFactor)
        {
            Position vector = new Position();
            vector.X = (float)(a.X * scaleFactor);
            vector.Y = (float)(a.Y * scaleFactor);
            vector.Z = (float)(a.Z * scaleFactor);

            return vector;
        }
Beispiel #4
0
        public bool MoveTo(Position destination, bool findPath)
        {
            m_destination = destination;

            // start moving
            MoveToDestination();

            // cannot move
            return false;
        }
Beispiel #5
0
        public float GetDistance(ref Position pt)
        {
            float dx = (pt.X - Position.X);
            float dy = (pt.Y - Position.Y);
            float dz = (pt.Z - Position.Z);

            return (float)Math.Sqrt((dx * dx) + (dy * dy) + (dz * dz));
        }
Beispiel #6
0
 public bool MoveTo(Position destination)
 {
     // TODO: Figure out when to send a query
     MoveState = 0;
     return MoveTo(destination, false);
 }