Beispiel #1
0
    public static List <BuildingOnVision> GetBuildingsOnVisionOfTeam(int[] teams)
    {
        List <int> alreadyCheckedTeams = new List <int>(teams.Length);

        List <BuildingOnVision> entitiesOnVisionOfSelectedTeam = new List <BuildingOnVision>();

        for (int i = 0; i < teams.Length; i++)
        {
            int team = teams[i];
            if (alreadyCheckedTeams.Contains(team))
            {
                throw new System.ArgumentException($"You are giving a list that contains duplicates of the team: {team}");
            }


            if (team < 0 || team > 7)
            {
                throw new System.ArgumentException("Currently only supporting 8 teams. 0-7 are the supported teams");
            }

            if (BuildingsOnVisionRangeOfTeams.ContainsKey(team))
            {
                entitiesOnVisionOfSelectedTeam.AddRange(BuildingsOnVisionRangeOfTeams[team]);
            }
            //else
            //throw new System.Exception($"the team selected: {team} doesn't have any entityon sight. Is there any entity of the team with SightRange component?");

            alreadyCheckedTeams.Add(team);
        }

        return(entitiesOnVisionOfSelectedTeam);
    }
Beispiel #2
0
    public static List <BuildingOnVision> GetBuildingsOnVisionOfTeam(int team)
    {
        if (team < 0 || team > 7)
        {
            throw new System.NotImplementedException("Currently only supporting 8 teams. 0-7 are the supported teams");
        }


        if (BuildingsOnVisionRangeOfTeams.ContainsKey(team))
        {
            return(BuildingsOnVisionRangeOfTeams[team]);
        }
        else
        {
            return(new List <BuildingOnVision>()); //throw new System.Exception($"the team selected: {team} doesn't have any entityon sight. Is there any entity of the team with SightRange component?");
        }
    }