public List<Peloton> GetNearbyEnemies(Peloton peloton) { List<Peloton> neighbours = new List<Peloton>(); if (peloton.GetLeader().name == Names.PLAYER_LEADER) { foreach (Peloton p in enemyTeam) { if (p != null && peloton != null && p != peloton && Vector3.Distance(p.transform.position, peloton.transform.position) < WATCH_DISTANCE) neighbours.Add(p); } } else { foreach (Peloton p in playerTeam) { if (p != null && peloton != null && p != peloton && Vector3.Distance(p.transform.position, peloton.transform.position) < WATCH_DISTANCE) neighbours.Add(p); } } return neighbours; }