Esempio n. 1
0
 internal Client(INetworkClient client, MatchConfig config) : base(client, config)
 {
     CurrentInput = new MatchInput(config);
     InputContext = new MatchInputContext(CurrentInput);
     NetworkClient.OnRecievedInputs += OnRecievedInputs;
     NetworkClient.OnRecievedState  += OnRecievedState;
 }
Esempio n. 2
0
 internal Client(INetworkClient client, MatchConfig config) : base(client, config)
 {
     NetworkClient.OnRecievedState  += OnRecievedState;
     NetworkClient.OnRecievedInputs += OnRecievedInputs;
     InputContext   = new MatchInputContext(config);
     InputHistory   = new InputHistory <MatchInput>(new MatchInput(config));
     NetworkConfig  = Config.Get <NetworkConfig>();
     InputSendTimer = 0;
 }
 internal Server(INetworkServer server, MatchConfig config) : base(server, config)
 {
     NetworkServer.ReceivedInputs += OnRecievedInputs;
     NetworkServer.PlayerRemoved  += OnRemovePlayer;
     InputContext    = new MatchInputContext(config);
     InputHistory    = new InputHistory <MatchInput>(new MatchInput(config));
     NetworkConfig   = Config.Get <NetworkConfig>();
     ClientTimesteps = new Dictionary <int, uint>();
     StateSendTimer  = 0;
 }
Esempio n. 4
0
 internal Server(INetworkServer server, MatchConfig config) : base(server, config)
 {
     NetworkServer.ReceivedInputs += OnRecievedInputs;
     InputContext    = new MatchInputContext(config);
     LatestInput     = new MatchInput[1];
     LatestInput[0]  = new MatchInput(config);
     InputHistory    = new InputHistory <MatchInput>(LatestInput[0]);
     NetworkConfig   = Config.Get <NetworkConfig>();
     ClientTimesteps = new Dictionary <uint, uint>();
     StateSendTimer  = 0;
 }
    public void Simulate_each_simulate_decreases_remaining_time()
    {
        var timeMatchRule = new TimeMatchRule();
        var config        = new MatchConfig {
            Stocks = 5, PlayerConfigs = new PlayerConfig[4]
        };
        var state = new MatchState(config)
        {
            Time = 100
        };
        var input        = new MatchInput(config);
        var inputContext = new MatchInputContext(input);

        Assert.AreEqual(99, timeMatchRule.Simulate(state, inputContext).Time);
    }
Esempio n. 6
0
 public virtual void Simulate(ref MatchState state, MatchInputContext input)
 {
 }
 public MatchState Simulate(MatchState state, MatchInputContext input)
 {
     state.Time--;
     return(state);
 }
 public override void Simulate(ref MatchState state, MatchInputContext input)
 {
     state.Time--;
 }
 public MatchState Simulate(MatchState state, MatchInputContext input) => state;
 public virtual MatchState Simulate(MatchState state, MatchInputContext input)
 {
     return(state);
 }