Beispiel #1
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.SimpleEvent);

            buf.WriteInt((int)Event);
        }
Beispiel #2
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.TickSync);

            buf.WriteInt(Tick);
            buf.WriteInt(Timestamp);
        }
Beispiel #3
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.SpawnPlayer);

            buf.WriteInt(PlayerId);
            buf.WriteBool(IsLocalPlayer);
        }
Beispiel #4
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)FrameworkNetworkMessageID.CommandRequest);

            buf.WriteInt(ForPlayerId);
            buf.WriteInt(ForTick);
        }
Beispiel #5
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.PlayerAdd);

            buf.WriteBool(Add);
            buf.WriteBool(ForLocalPlayer);
            buf.WriteInt(PlayerId);
            buf.WriteString(PlayerName);
        }
Beispiel #6
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.LazerHit);

            buf.WriteInt(AtTick);
            buf.WriteInt(FiringPlayerId);
            buf.WriteQuaternion(FiringRotation);
            buf.WriteInt(HitCharacterId);
        }
Beispiel #7
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.SpawnCharacter);

            buf.WriteInt(CharacterId);
            buf.WriteInt(ForPlayerId);
            buf.WriteVector3(SpawnPosition);
            buf.WriteQuaternion(SpawnRotation);
        }
        private void SerializePlayerCommands(SerializationBuffer buf, PC forPlayer, int forTick, bool mustBeFullState)
        {
            buf.SeekZero();
            buf.WriteInt((int)FrameworkNetworkMessageID.PlayerCommands);

            buf.WriteInt(forTick);
            buf.WriteInt(forPlayer.GetId());

            CMD currentCommands = forPlayer.GetCommands();

            currentCommands.WriteToBuffer(buf, mustBeFullState);
        }
Beispiel #9
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.SceneLoading);

            buf.WriteString(SceneName);
        }
Beispiel #10
0
        public void Serialize(SerializationBuffer buf)
        {
            buf.SeekZero();
            buf.WriteInt((int)NetworkMessageID.PlayerRegistration);

            buf.WriteString(PlayerName);
        }
        public void WriteToBuffer(SerializationBuffer buf, bool mustBeFullState)
        {
            int characterStatesCount = CharacterStates.Count;

            buf.WriteInt(characterStatesCount);
            for (int i = 0; i < characterStatesCount; i++)
            {
                buf.WriteInt(CharacterStates[i].DataId);

                buf.WriteVector3(CharacterStates[i].DataStruct.MotorState.Position);
                buf.WriteQuaternion(CharacterStates[i].DataStruct.MotorState.Rotation);
                buf.WriteVector3(CharacterStates[i].DataStruct.MotorState.BaseVelocity);

                buf.WriteBool(CharacterStates[i].DataStruct.IsStunned);
            }
        }
        private void SerializeGlobalSnapshot(SerializationBuffer buf, ref GlobalSnapshot <CMD, WS> forSnapshot, int forTick, bool mustBeFullState)
        {
            buf.SeekZero();
            buf.WriteInt((int)FrameworkNetworkMessageID.GlobalState);

            buf.WriteInt(forTick);

            // Commands snapshot
            int commandsCount = forSnapshot.CommandsSnapshot.PlayerCommands.Count;

            buf.WriteInt(commandsCount);
            for (int i = 0; i < commandsCount; i++)
            {
                buf.WriteInt(forSnapshot.CommandsSnapshot.PlayerCommands[i].DataId);
                forSnapshot.CommandsSnapshot.PlayerCommands[i].DataStruct.WriteToBuffer(buf, mustBeFullState);
            }

            // World snapshot
            forSnapshot.WorldSnapshot.WriteToBuffer(buf, mustBeFullState);
        }