I'm currently working on an FPS and trying to create a "Gamemode" controller that gives the team with the most team members within a defined 3d area a point for their team. My first attempt looks something like:
public class TDM : Gamemode
{
private Collider pointArea;
private Dictionary<Player, int> teamA;
private Dictionary<Player, int> teamB;
private int methodNumberOfPlayersOnPoint(List<Player> players)
{
int count = 0;
foreach (Player player in players)
{
if (pointArea.bounds.Contains(player.transform.position))
{
count++;
}
}
return count;
}
}
is there a better way to do this?