Esempio n. 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);
        }
Esempio n. 2
0
        public static Rush AddStats(List <Stats> list)
        {
            int yards = 0, yardsAfterContact = 0, attempts = 0, fumbles = 0, touchdowns = 0;

            foreach (Stats stat in list)
            {
                if (stat is Rush)
                {
                    Rush item = stat as Rush;
                    yards             += item.yards;
                    yardsAfterContact += item.yardsAfterContact;
                    attempts          += item.attempts;
                    fumbles           += item.fumbles;
                    touchdowns        += item.touchdowns;
                }
            }

            return(new Rush(yards, yardsAfterContact, attempts, fumbles, touchdowns));
        }