예제 #1
0
    public void PassSuccess(Athlete passer, Athlete receiver)
    {
        //Debug.Log("pass success");

        passer.IncrementStat(StatType.PassesCompleted);

        NewPlay(receiver);
    }
예제 #2
0
    public void ShotFailure(Athlete shooter, Athlete defender)
    {
        //Debug.Log("shot failure");

        defender.IncrementStat(StatType.Saves);

        NewPossession(defense);
    }
예제 #3
0
    public void PassFailure(Athlete passer, Athlete stealer)
    {
        //Debug.Log("pass failure");

        stealer.IncrementStat(StatType.Steals);

        NewPossession(defense);
    }
예제 #4
0
    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);
        }
    }
예제 #5
0
    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);
    }
예제 #6
0
    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);
        }
    }