示例#1
0
 /// <summary>
 /// Returns the registered Game Object near a given position
 /// </summary>
 public GameObjectAnimator VGOGet(Vector2 mapPos, float distance)
 {
     distance *= distance;
     CheckVGOsArrayDirty();
     for (int k = 0; k < vgosCount; k++)
     {
         GameObjectAnimator go = vgos[k];
         float d = FastVector.SqrDistanceByValue(go.currentMap2DLocation, mapPos); // Vector2.SqrMagnitude (go.currentMap2DLocation - mapPos);
         if (d <= distance)
         {
             return(go);
         }
     }
     return(null);
 }
示例#2
0
        /// <summary>
        /// Returns the registered Game Object near a given position
        /// </summary>
        public GameObjectAnimator VGOGet(Vector2 mapPos, float distance)
        {
            distance *= distance;
            List <GameObjectAnimator> gos = new List <GameObjectAnimator> (vgos.Values);
            int gosCount = gos.Count;

            for (int k = 0; k < gosCount; k++)
            {
                GameObjectAnimator go = gos [k];
                float d = FastVector.SqrDistanceByValue(go.currentMap2DLocation, mapPos);                  // Vector2.SqrMagnitude (go.currentMap2DLocation - mapPos);
                if (d <= distance)
                {
                    return(go);
                }
            }
            return(null);
        }