Example #1
0
        public static void HandleEntityUpdate(int _connectionID, byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int    _packetID = _buffer.ReadInteger();
            string _guid     = _buffer.ReadString();

            r_Vector3 _position = new r_Vector3(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());

            _buffer.Dispose();

            r_WorldManager.UpdateEntityPosition(_guid, _position);
        }
Example #2
0
        public static void HandleEntityUpdatePacket(byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int    _packetID = _buffer.ReadInteger();
            string _guid     = _buffer.ReadString();

            Vector3    _position = new Vector3(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());
            Quaternion _rotation = new Quaternion(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());

            EntityType _entityType = (EntityType)_buffer.ReadInteger();

            _buffer.Dispose();

            r_WorldObjectManager.UpdateObjectPosition(_guid, _position, _rotation, _entityType);
        }
        public static void HandleWorldObjects(byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int _packetID = _buffer.ReadInteger();

            string _prefab = _buffer.ReadString();
            string _guid   = _buffer.ReadString();

            Vector3    _position = new Vector3(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());
            Quaternion _rotation = new Quaternion(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());

            EntityType _entityType = (EntityType)_buffer.ReadInteger();

            _buffer.Dispose();

            r_NetworkInstantiate.InstantiateWorldObject(_prefab, _guid, _position, _rotation, _entityType);
        }
        public static void HandlePlayerUpdate(int _connectionID, byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int _packetID = _buffer.ReadInteger();

            r_Vector3    _position = new r_Vector3(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());
            r_Quaternion _rotation = new r_Quaternion(_buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat(), _buffer.ReadFloat());

            _buffer.Dispose();

            if (r_ClientManager.m_Clients.ContainsKey(_connectionID))
            {
                r_ClientManager.m_Clients[_connectionID].m_Position = _position;
                r_ClientManager.m_Clients[_connectionID].m_Rotation = _rotation;
            }

            r_ClientManager.UpdateNetworkPlayer(_connectionID, _position, _rotation);
        }
        public static void HandlePlayerUpdate(byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int _packetID = _buffer.ReadInteger();
            int _index    = _buffer.ReadInteger();

            float _pX = _buffer.ReadFloat();
            float _pY = _buffer.ReadFloat();
            float _pZ = _buffer.ReadFloat();


            float _rX = _buffer.ReadFloat();
            float _rY = _buffer.ReadFloat();
            float _rZ = _buffer.ReadFloat();
            float _rW = _buffer.ReadFloat();

            _buffer.Dispose();

            r_NetworkManager.instance.UpdateRemotePlayer(_index, _pX, _pY, _pZ, _rX, _rY, _rZ, _rW);
        }
        public static void HandlePlayerAnimatorUpdate(byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int _packetID = _buffer.ReadInteger();
            int _index    = _buffer.ReadInteger();

            int _animatorType = _buffer.ReadInteger();

            switch (_animatorType)
            {
            case (int)AnimatorValueType.Int:
                r_NetworkManager.instance.SetRemoteAnimatorValues(_index, _buffer.ReadString(), _buffer.ReadInteger());
                break;

            case (int)AnimatorValueType.Bool:
                r_NetworkManager.instance.SetRemoteAnimatorValues(_index, _buffer.ReadString(), _buffer.ReadBool());
                break;

            case (int)AnimatorValueType.Float:
                r_NetworkManager.instance.SetRemoteAnimatorValues(_index, _buffer.ReadString(), _buffer.ReadFloat());
                break;
            }

            _buffer.Dispose();
        }
        public static void HandlePlayerAnimatorUpdate(int _connectionID, byte[] _data)
        {
            r_ByteBuffer _buffer = new r_ByteBuffer();

            _buffer.WriteBytes(_data);

            int _packetID     = _buffer.ReadInteger();
            int _animatorType = _buffer.ReadInteger();

            switch ((int)_animatorType)
            {
            case (int)AnimatorValueType.Int:
                r_ClientManager.UpdatePlayerAnimator(_connectionID, _buffer.ReadString(), _buffer.ReadInteger());
                break;

            case (int)AnimatorValueType.Bool:
                r_ClientManager.UpdatePlayerAnimator(_connectionID, _buffer.ReadString(), _buffer.ReadBool());
                break;

            case (int)AnimatorValueType.Float:
                r_ClientManager.UpdatePlayerAnimator(_connectionID, _buffer.ReadString(), _buffer.ReadFloat());
                break;
            }

            _buffer.Dispose();
        }