예제 #1
0
        public static Shot CreateShot(int playerShooting, Shot previousShot, Advantage advantage, ShotType previousShotType)
        {
            PlayerMatchInstance     player = MatchEngine.Instance.GetPlayer(playerShooting);
            ShotType                type   = GenerateShotTypeProbabilities(previousShot.type, player).Calculate();
            ShotCoord               from   = previousShot.to;
            ShotCoord               to     = CalculateShotCoord(GenerateShotCoordProbabilities(type, player));
            ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(to, playerShooting, type, advantage, previousShotType);
            float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences);

            return(new Shot(playerShooting, type, from, to, shotResultProbabilities, false, shotTime));
        }
예제 #2
0
        public static Serve CreateServe(int playerShooting, Score score)
        {
            PlayerMatchInstance player = MatchEngine.Instance.GetPlayer(playerShooting);
            int       points           = GetPlayerServingPoints(playerShooting, score);
            ShotCoord from             = GetFromForServing(points);
            ShotCoord to   = GetToForServing(points);
            ShotType  type = ShotType.LONG;
            ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(playerShooting, type);
            float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences);

            return(new Serve(playerShooting, type, from, to, shotResultProbabilities, shotTime));
        }