public void PassSuccess(Athlete passer, Athlete receiver) { //Debug.Log("pass success"); passer.IncrementStat(StatType.PassesCompleted); NewPlay(receiver); }
public void ShotFailure(Athlete shooter, Athlete defender) { //Debug.Log("shot failure"); defender.IncrementStat(StatType.Saves); NewPossession(defense); }
public void PassFailure(Athlete passer, Athlete stealer) { //Debug.Log("pass failure"); stealer.IncrementStat(StatType.Steals); NewPossession(defense); }
public void AttemptShot(Athlete shooter) { Athlete defender = defense.roster[Random.Range(0, defense.roster.Count)]; shooter.IncrementStat(StatType.ShotsAttempted); float shotRoll = Random.value * shooter.GetAttribute(AttributeType.Shooting).value; float defenseRoll = Random.value * defender.GetAttribute(AttributeType.Defending).value; if (shotRoll > defenseRoll) { ShotSuccess(shooter); } else { ShotFailure(shooter, defender); } }
public void ShotSuccess(Athlete shooter) { //Debug.Log("shot success"); shooter.IncrementStat(StatType.Goals); if (offense == homeTeam) { homeScore++; } else { awayScore++; } Debug.Log("GOAL! " + homeScore + " to " + awayScore); NewPossession(defense); }
public void AttemptPass(Athlete passer) { Athlete receiver = passer; Athlete defender = defense.roster[Random.Range(0, defense.roster.Count)]; while (receiver == passer) { receiver = offense.roster[Random.Range(0, offense.roster.Count)]; } passer.IncrementStat(StatType.PassesAttempted); float passRoll = Random.value * passer.GetAttribute(AttributeType.Passing).value; float defenseRoll = Random.value * defender.GetAttribute(AttributeType.Defending).value; if (passRoll >= defenseRoll) { PassSuccess(passer, receiver); } else { PassFailure(passer, defender); } }