/// <summary> /// Gets all goals scored by a team, including those scored by the /// whole alliance and global goals. /// </summary> /// <param name="team">Team whose goals to retrieve</param> /// <returns>List of goals scored by the team</returns> public List <Goal> GetGoalsByTeam(Team team) { AllianceColor color = GetTeamColor(team); if (Goals == null) { return(new List <Goal>()); } return(Goals.FindAll((g) => { if (g.Global) { return true; } if (g.FullAlliance) { if (g.ScoringAlliance.HasValue) { return g.ScoringAlliance == color; } return false; // INVALID } return g.ScoringTeam == team; })); }