Exemplo n.º 1
0
    public static List <EntityOnVision> GetUnitsOnVisionOfTeam(int[] teams)
    {
        List <int> alreadyCheckedTeams = new List <int>(teams.Length);

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

        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 (UnitsOnVisionRangeOfTeams.ContainsKey(team))
            {
                entitiesOnVisionOfSelectedTeam.AddRange(UnitsOnVisionRangeOfTeams[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);
    }
Exemplo n.º 2
0
    public static List <EntityOnVision> GetUnitsOnVisionOfTeam(int team)
    {
        if (team < 0 || team > 7)
        {
            throw new System.NotImplementedException("Currently only supporting 8 teams. 0-7 are the supported teams");
        }


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