public void Setup()
 {
     _predicter = new ShipLocationPredicter(() => _shipData, SetShipLocation);
     var on = new ControlState(1, true);
     var off = new ControlState(0, false);
     _turningLeft = new[] { off, on, off, off, off, off, off };
     _shipData = new ShipLocationPredicter.ShipData
     {
         ShipLocationEntry = new ShipLocationEntry
         {
             Rotation = 0,
             Pos = Vector2.Zero,
             Move = Vector2.Zero,
             GameTime = TimeSpan.Zero,
             ControlStates = _turningLeft,
         },
         TargetElapsedTime = TimeSpan.FromSeconds(1f / 20),
         ThrustForce = 120000,
         TurnSpeed = 1,
         Mass = 350,
     };
     _entry1 = new ShipLocationEntry
     {
         GameTime = TimeSpan.FromSeconds(1),
         Pos = new Vector2(100, 100),
         Move = new Vector2(1000, 0),
         Rotation = 1,
         ControlStates = _turningLeft,
     };
     _entry2 = new ShipLocationEntry
     {
         GameTime = TimeSpan.FromSeconds(1.1),
         Pos = new Vector2(200, 100),
         Move = new Vector2(1000, 0),
         Rotation = 1.1f,
         ControlStates = _turningLeft,
     };
     _entry3 = new ShipLocationEntry
     {
         GameTime = TimeSpan.FromSeconds(1.2),
         Pos = new Vector2(300, 100),
         Move = new Vector2(1000, 0),
         Rotation = 1.2f,
         ControlStates = _turningLeft,
     };
 }
Exemplo n.º 2
0
 private void SetLocationPredicter()
 {
     if (Game.NetworkMode == NetworkMode.Client && Owner != null)
     {
         if (!Owner.IsLocal && LocationPredicter == null) LocationPredicter = new ShipLocationPredicter(this);
         if (Owner.IsLocal && LocationPredicter != null) LocationPredicter = null;
     }
 }