using UnityEngine;
using System.Collections.Generic;

public static class Util
{
	public static List<Player> GetPlayersInRange(Vector3 center, float radius)
	{
		List<Player> list = new List<Player>();
		Player[] objs = GameObject.FindObjectsOfType<Player>();
		for (int i = 0; i < objs.Length; i++)
		{
			if (Vector3.Distance(objs[i].transform.position, center) <= radius)
				list.Add(objs[i]);
		}
		return list;
	}
	
	public static List<City> GetCitiesInRange(Vector3 center, float radius)
	{
		List<City> list = new List<City>();
		City[] objs = GameObject.FindObjectsOfType<City>();
		for (int i = 0; i < objs.Length; i++)
		{
			if (Vector3.Distance(objs[i].transform.position, center) <= radius)
				list.Add(objs[i]);
		}
		return list;
	}	
}
