Example #1
0
        public static void SendAuthenticationToServer(string _clientVersion)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ClientPackets.Authentication);
            _buffer.WriteString(_clientVersion);

            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
Example #2
0
        public static void SendNetworkName(string _networkName)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ClientPackets.SetNetworkName);
            _buffer.WriteString(_networkName);

            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
        public static void SendNetworkName(int _index, string _networkName)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ServerPackets.SetNetworkName);
            _buffer.WriteInteger(_index);
            _buffer.WriteString(_networkName);

            r_ClientManager.SendDataToAll(_buffer.ToArray());

            _buffer.Dispose();
        }
        public static void SendInstantiateRemotePlayer(int _index, int _connectionID, string _networkName)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ServerPackets.InstantiateRemotePlayer);
            _buffer.WriteInteger(_index);
            _buffer.WriteString(_networkName);

            r_ClientManager.SendDataTo(_connectionID, _buffer.ToArray());

            _buffer.Dispose();
        }
Example #5
0
        public static void SendAnimatorValue(string _paramaterName, bool _value)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ClientPackets.UpdatePlayerAnimator);

            _buffer.WriteInteger((int)AnimatorValueType.Bool);
            _buffer.WriteString(_paramaterName);
            _buffer.WriteBool(_value);

            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
Example #6
0
        public static void SendWorldObjectsToClient(int _connectionID, string _prefab, string _guid, r_Vector3 _position, r_Quaternion _rotation, EntityType _entityType)
        {
            r_ByteBuffer _ByteBuffer = new r_ByteBuffer();

            _ByteBuffer.WriteInteger((int)ServerPackets.InstantiateWorldObjects);

            _ByteBuffer.WriteString(_prefab);
            _ByteBuffer.WriteString(_guid);

            _ByteBuffer.WriteFloat(_position.x);
            _ByteBuffer.WriteFloat(_position.y);
            _ByteBuffer.WriteFloat(_position.z);

            _ByteBuffer.WriteFloat(_rotation.x);
            _ByteBuffer.WriteFloat(_rotation.y);
            _ByteBuffer.WriteFloat(_rotation.z);
            _ByteBuffer.WriteFloat(_rotation.w);

            _ByteBuffer.WriteInteger((int)_entityType);

            r_ClientManager.SendDataTo(_connectionID, _ByteBuffer.ToArray());

            _ByteBuffer.Dispose();
        }
Example #7
0
        public static void SendAnimatorValue(string _paramaterName, float _value)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ClientPackets.UpdatePlayerAnimator);

            _buffer.WriteInteger((int)AnimatorValueType.Float);
            _buffer.WriteString(_paramaterName);
            _buffer.WriteFloat(_value);

            UnityEngine.Debug.Log($"[SENDING][FLOAT] ({_value}) to server");
            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
        public static void HandlePlayerAnimatorUpdate(int _index, string _paramaterName, float _value)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ServerPackets.UpdatePlayerAnimator);
            _buffer.WriteInteger(_index);

            //send to clients
            _buffer.WriteInteger((int)AnimatorValueType.Float);
            _buffer.WriteString(_paramaterName);
            _buffer.WriteFloat(_value);

            r_ClientManager.SendDataToAll(_buffer.ToArray());

            _buffer.Dispose();
        }
        public static void SendEntityUpdate(string _guid, Vector3 _position)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteInteger((int)ClientPackets.UpdateEntity);

            _buffer.WriteString(_guid);

            _buffer.WriteFloat(_position.x);
            _buffer.WriteFloat(_position.y);
            _buffer.WriteFloat(_position.z);

            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
Example #10
0
        public static void SendWorldObjectUpdateToClient(string _guid, r_Vector3 _position, r_Quaternion _rotation, EntityType _entityType)
        {
            r_ByteBuffer _ByteBuffer = new r_ByteBuffer();

            _ByteBuffer.WriteInteger((int)ServerPackets.UpdateEntity);

            _ByteBuffer.WriteString(_guid);

            _ByteBuffer.WriteFloat(_position.x);
            _ByteBuffer.WriteFloat(_position.y);
            _ByteBuffer.WriteFloat(_position.z);

            _ByteBuffer.WriteFloat(_rotation.x);
            _ByteBuffer.WriteFloat(_rotation.y);
            _ByteBuffer.WriteFloat(_rotation.z);
            _ByteBuffer.WriteFloat(_rotation.w);

            _ByteBuffer.WriteInteger((int)_entityType);

            r_ClientManager.SendDataToAll(_ByteBuffer.ToArray());

            _ByteBuffer.Dispose();
        }