示例#1
0
        public static List <Stats> GetTacklesByPlayer(Player p, List <StatsHolder> stats)
        {
            if (p == null)
            {
                return(null);
            }
            List <Stats> retVal = new List <Stats>();

            foreach (StatsHolder stat in stats)
            {
                if (stat.GetStat() is Rush)
                {
                    Rush rush = stat.GetStat() as Rush;
                    if (p.Equals(rush.tackler))
                    {
                        retVal.Add(rush);
                    }
                }
                else if (stat.GetStat() is Reception)
                {
                    Reception reception = stat.GetStat() as Reception;
                    if (p.Equals(reception.tackler))
                    {
                        retVal.Add(reception);
                    }
                }
            }
            return(retVal);
        }
示例#2
0
        public static Reception AddStats(List <Stats> list)
        {
            int    completions = 0, attempts = 0, interceptions = 0, touchdowns = 0;
            double yardsInAir = 0.0, yardsAfterCatch = 0.0;

            foreach (Stats value in list)
            {
                if (value is Reception)
                {
                    Reception item = value as Reception;
                    completions     += item.completions;
                    attempts        += item.attempts;
                    interceptions   += item.interceptions;
                    yardsInAir      += item.yardsInAir;
                    yardsAfterCatch += item.yardsAfterCatch;
                    touchdowns      += item.touchdowns;
                }
            }
            return(new Reception(completions, attempts, touchdowns, interceptions, yardsInAir, yardsAfterCatch));
        }