/// <summary> /// /// </summary> /// <param name="thrower">Player</param> /// <param name="receiver">Player</param> /// <param name="yards">int</param> /// <param name="isTd">int</param> public void CompletePass(Player thrower, Player receiver, int yards, bool isTd) { this.attempts++; this.completions++; this.yards += yards; this.completionPct = CalculatePercentage(attempts, completions); this.passerRating = PassPlayStatSheet.CalculatePasserRating(this.attempts, this.yards, this.touchdowns.Count, this.completions, this.interceptions); CheckLongPlay(yards); //update receiver stats here: //receiverGameStats.AddRun(yards, isTd, false); //((CarryStatSheet)receiver.Stats[StatTypes.Receive]).AddRun(yards, isTd,false); if (isTd) { AddTouchdown(yards); } }
/// <summary> /// /// </summary> /// <param name="sheets">StatSheet[]</param> /// <returns>StatSheet</returns> protected override StatSheet AggregateStatSheets(params StatSheet[] sheets) { PassPlayStatSheet ret = new PassPlayStatSheet((Player)this.entity); foreach (PassPlayStatSheet sheet in sheets) { ret.yards += sheet.yards; ret.touchdowns.AddRange(sheet.touchdowns.ToArray()); ret.completions += sheet.completions; ret.attempts += sheet.attempts; ret.completionPct = CalculatePercentage(ret.attempts, ret.completions); ret.passerRating = PassPlayStatSheet.CalculatePasserRating(ret.attempts, ret.yards, ret.touchdowns.Count, ret.completions, ret.interceptions); if (sheet.longPlay > ret.LongPlay) { ret.longPlay = sheet.LongPlay; } } return(ret); }