Пример #1
0
 /// <summary>
 /// Get a list of registered Game Objects inside a rectangle. Optionally provide a predicate function to filer units.
 /// </summary>
 /// <returns>The get.</returns>
 /// <param name="rect">Rect.</param>
 /// <param name="predicate">Predicate function that returns true for each unit passed.</param>
 public int VGOGet(Rect rect, List <GameObjectAnimator> results, AttribPredicate predicate = null)
 {
     CheckVGOsArrayDirty();
     results.Clear();
     for (int k = 0; k < vgosCount; k++)
     {
         GameObjectAnimator go = vgos[k];
         if (rect.Contains(go.currentMap2DLocation) && (predicate == null || predicate(go.attrib)))
         {
             results.Add(go);
         }
     }
     return(results.Count);
 }
Пример #2
0
        /// <summary>
        /// Returns a list of cities whose attributes matches predicate
        /// </summary>
        public List <City> GetCities(AttribPredicate predicate)
        {
            List <City> selectedCities = new List <City>();
            int         cityCount      = cities.Count;

            for (int k = 0; k < cityCount; k++)
            {
                City city = _cities[k];
                if (predicate(city.attrib))
                {
                    selectedCities.Add(city);
                }
            }
            return(selectedCities);
        }
Пример #3
0
        /// <summary>
        /// Returns a list of mount points whose attributes matches predicate
        /// </summary>
        public List <MountPoint> GetMountPoints(AttribPredicate predicate)
        {
            List <MountPoint> selectedMountPoints = new List <MountPoint>();
            int mountPointCount = mountPoints.Count;

            for (int k = 0; k < mountPointCount; k++)
            {
                MountPoint mountPoint = mountPoints[k];
                if (predicate(mountPoint.attrib))
                {
                    selectedMountPoints.Add(mountPoint);
                }
            }
            return(selectedMountPoints);
        }
Пример #4
0
        /// <summary>
        /// Get a list of registered Game Objects inside a rectangle. Optionally provide a predicate function to filer units.
        /// </summary>
        /// <returns>The get.</returns>
        /// <param name="rect">Rect.</param>
        /// <param name="predicate">Predicate function that returns true for each unit passed.</param>
        public int VGOGet(Rect rect, List <GameObjectAnimator> results, AttribPredicate predicate = null)
        {
            List <GameObjectAnimator> gos = new List <GameObjectAnimator> (vgos.Values);

            results.Clear();
            int gosCount = gos.Count;

            for (int k = 0; k < gosCount; k++)
            {
                GameObjectAnimator go = gos [k];
                if (rect.Contains(go.currentMap2DLocation) && (predicate == null || predicate(go.attrib)))
                {
                    results.Add(go);
                }
            }
            return(results.Count);
        }