Exemple #1
0
        public IEnumerable <Mob> GetMobsInCircle(Vector2 origin, int radius)
        {
            IEnumerable <Mob> mobsInRectangle = GetMobsInRectangle(
                new Rectangle((int)origin.X - radius, (int)origin.Y - radius, radius * 2, radius * 2));

            HashedList <Mob> results = new HashedList <Mob>();

            foreach (Mob mob in mobsInRectangle)
            {
                if (Vector2.Distance(mob.PositionInWorldByUpdate, origin) <= Math.Abs(mob.CollisionRectangle.Width / 2 + radius))
                {
                    results.Add(mob);
                }
            }

            return(results);
        }
 public MutableDistinctSet()
 {
     _values         = new HashedList <T>();
     _valuesToAdd    = new HashedList <T>();
     _valuesToRemove = new HashedList <T>();
 }