public List <Script_Wolf> GetWolvesWithinRange(int p_range) { List <Script_Wolf> wolves = _grid.GetWolves(); List <Script_Wolf> wolvesWithinRange = new List <Script_Wolf>(); int xCurrent = GetCurrentGridPosition().x; int zCurrent = GetCurrentGridPosition().z; foreach (Script_Wolf wolf in wolves.ToList()) { if (wolf != null && wolf.GetWolfObject() != null) { if (Vector3Int.Distance(GetCurrentGridPosition(), wolf.GetCurrentGridPosition()) <= p_range) { wolvesWithinRange.Add(wolf); } } } return(wolvesWithinRange); }