public PointStandaloneTest() { playerA = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, 60, Hands.Right, new Color(0, 0, 0)); playerB = new PlayerStandalone(Guid.NewGuid(), "Kotori Minami", Gender.Female, 159.0, 54, Hands.Right, new Color(0, 0, 0)); teamA = new SinglesTeam(playerA, Guid.NewGuid()); teamB = new SinglesTeam(playerB, Guid.NewGuid()); }
public void ThrowsOnNaNWeight() { Assert.Catch <ArgumentOutOfRangeException>(() => { _ = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, double.NaN, Hands.Right, new Color(Vector3.Zero)); }); }
public void ThrowsOnInfinityHeight() { Assert.Catch <ArgumentOutOfRangeException>(() => { _ = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, double.PositiveInfinity, 60, Hands.Right, new Color(Vector3.Zero)); }); }
public void ThrowsOnEmptyName() { Assert.Catch <ArgumentNullException>(() => { _ = new PlayerStandalone(Guid.NewGuid(), "", Gender.Female, 159.0, 60, Hands.Right, new Color(Vector3.Zero)); }); }
private static void PrepareStandardMatch(MatchRuleStandalone matchRule, out PlayerStandalone playerA, out PlayerStandalone playerB, out SinglesTeam teamA, out SinglesTeam teamB, out MatchStandalone <SinglesTeam> match) { playerA = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, 60, Hands.Right, new Color(1.0f, 1.0f, 0.0f)); playerB = new PlayerStandalone(Guid.NewGuid(), "Kotori Minami", Gender.Female, 159.0, 54, Hands.Right, new Color(0.0f, 1.0f, 1.0f)); teamA = new SinglesTeam(playerA, Guid.NewGuid()); teamB = new SinglesTeam(playerB, Guid.NewGuid()); var pcf = FifteenBasedPointCounter.CreateFactory(true); var gcf = AdvantageSetGameCounter.CreateFactory(pcf, matchRule.GamesPerSet, 2); match = new MatchStandalone <SinglesTeam>(teamA, teamB, matchRule, EnumTeams.TeamA, new StandardSetCounter(gcf, matchRule.Sets, EnumTeams.TeamA)); }
public void OnLoad() { matchRule = new MatchRuleStandalone(false, true, 2, 7, true); playerA = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, 60, Hands.Right, new Color(Vector3.Zero)); playerB = new PlayerStandalone(Guid.NewGuid(), "Kotori Minami", Gender.Female, 159.0, 54, Hands.Right, new Color(Vector3.Zero)); teamA = new SinglesTeam(playerA, Guid.NewGuid()); teamB = new SinglesTeam(playerB, Guid.NewGuid()); match = new MatchStandalone <SinglesTeam>(teamA, teamB, matchRule, EnumTeams.TeamA, new StandardSetCounter(new SimpleFactory <AdvantageSetGameCounter>(() => { return(new AdvantageSetGameCounter(new SimpleFactory <FifteenBasedPointCounter>(() => { return new FifteenBasedPointCounter(true); }), 6, 2)); }), 5)); match.StartMatch(); match.CurrentSet.StartSet(); match.CurrentSet.CurrentGame.StartGame(); RefreshPoints(); }
public PlayerModel(PlayerStandalone player) { Player = player ?? throw new ArgumentNullException(nameof(player)); Color = new Color(player.Color.Red, player.Color.Green, player.Color.Blue); }
public IEnumerable <IStatItem <double> > Calculate <TTeam>(Rally <TTeam> gameManager, PlayerStandalone player) where TTeam : class, ITeamInMatch { var services = gameManager.AllPoints.SelectMany(a => a.Receives.TakeWhile(p => p.ReceivedPlayer == player)); var sFaults = services.Where(a => a.IsServiceFault); var cSum = services.Count(); var cFaults = sFaults.Count(); var failRate = (double)cFaults / cSum; yield return(new SimpleStatItem <double>("Service Faults", $"{cFaults} ({failRate:P})", failRate)); }
public PlayerStatsPair(PlayerStandalone player, IEnumerable <IStatItem <TValue> > stats) { Player = player ?? throw new ArgumentNullException(nameof(player)); Stats = stats ?? throw new ArgumentNullException(nameof(stats)); }
public PlayerModelWithEnability(PlayerStandalone player, bool isEnabled) : base(player) { IsEnabled = isEnabled; }