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();
        }
コード例 #2
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();
        }
コード例 #4
0
        public static void SendPlayerUpdate(float _pX, float _pY, float _pZ, float _rX, float _rY, float _rZ, float _rW)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

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

            _buffer.WriteFloat(_pX);
            _buffer.WriteFloat(_pY);
            _buffer.WriteFloat(_pZ);

            _buffer.WriteFloat(_rX);
            _buffer.WriteFloat(_rY);
            _buffer.WriteFloat(_rZ);
            _buffer.WriteFloat(_rW);

            r_Client.SendData(_buffer.ToArray());

            _buffer.Dispose();
        }
        /// <summary>
        /// Handles the player's position and rotation update
        /// </summary>
        public static void HandlePlayerUpdate(int _index, r_Vector3 _position, r_Quaternion _rotation)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

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

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

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

            r_ClientManager.SendDataToAll(_buffer.ToArray());

            _buffer.Dispose();
        }
コード例 #6
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();
        }
コード例 #7
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();
        }