public override void Deserialize(Bitstream msg) { State = new List<PlayerStateData>(); int count = msg.ReadUInt16(); for (int i = 0; i < count; ++i) { var o = new PlayerStateData(); o.Forward = msg.ReadBool(); o.Back = msg.ReadBool(); o.Left = msg.ReadBool(); o.Right = msg.ReadBool(); o.Position = msg.ReadVector2(); o.SimTick = (uint)msg.ReadInt32(); State.Add(o); } SnapId = msg.ReadInt32(); }
protected void AddClientState(PlayerStateData state) { _stateList.Add(state); _moveBuffer.AddToTail(state); }
private void SendClientState() { if (GetServerNode() == null) return; var states = GetClientState(); if (states == null) return; var playerEnt = GetPlayer(); if (playerEnt == null) return; ClientStatePacket packet = new ClientStatePacket(); packet.State = states; packet.PreviousState = _lastClientState; packet.PlayerId = (uint)playerEnt.UniqueId; _lastClientState = states.Count > 0 ? states.Last() : null; _bifrost.Send(packet, 1); }
internal static void SetCurrentPlayerState(uint id, PlayerStateData data) { var e = _manager.GetEntityByUniqueId(id); EntitySystems.Components.PlayerComponent pc = e.GetComponent<EntitySystems.Components.PlayerComponent>(); if (pc != null) { pc.LastSyncState = data; } }