DodongosQuest.World.GetCreaturesWithinVisibleDistanceOfPlayer C# (CSharp) Method

GetCreaturesWithinVisibleDistanceOfPlayer() public method

public GetCreaturesWithinVisibleDistanceOfPlayer ( int range ) : List
range int
return List
        public List<ICreature> GetCreaturesWithinVisibleDistanceOfPlayer(int range)
        {
            SortedList<string, ICreature> creaturesWithinRange = new SortedList<string, ICreature>();

            foreach (ICreature creature in _creatures)
            {
                if (CanPlayerSeeWorldIndex(creature.WorldIndex))
                {
                    int distanceFromPlayer = GetStraightLineDistance(Player.WorldIndex, creature.WorldIndex);
                    if (distanceFromPlayer <= range)
                        creaturesWithinRange.Add(distanceFromPlayer.ToString() + Guid.NewGuid().ToString(), creature);
                }
            }

            return new List<ICreature>(creaturesWithinRange.Values);
        }