Exemplo n.º 1
0
 public void RegisterReadable(IServerReadable readable, ClientDataTags tag)
 {
     if (readable != null)
     {
         readables[tag] = readable;
     }
 }
Exemplo n.º 2
0
        public void HandlePlayerInputFromReader(DarkRiftReader reader, ClientDataTags tag)
        {
            var data = reader.ReadSerializable <VRTransformData>();

            head.transform.localPosition  = data.vrTransforms[0].position;
            left.transform.localPosition  = data.vrTransforms[1].position;
            right.transform.localPosition = data.vrTransforms[2].position;

            head.transform.localRotation  = data.vrTransforms[0].rotation;
            left.transform.localRotation  = data.vrTransforms[1].rotation;
            right.transform.localRotation = data.vrTransforms[2].rotation;
        }
 public void HandlePlayerInputFromReader(DarkRiftReader reader, ClientDataTags tag)
 {
     if (tag == ClientDataTags.MoveObject)
     {
         var data = reader.ReadSerializable <MovementData>();
         networkEntity.rotation = data.rotation;
         var maxDir = Mathf.Max(data.movementVector.x, data.movementVector.y, data.movementVector.z);
         if (maxDir > 1f)
         {
             data.movementVector /= maxDir;
         }
         networkEntity.position += data.movementVector * speed * Time.fixedDeltaTime;
     }
     else if (tag == ClientDataTags.SetObjectPosition)
     {
         var data = reader.ReadSerializable <MovementData>();
         networkEntity.rotation = data.rotation;
         var movVector = (data.movementVector - networkEntity.position);
         if (movVector.magnitude < snapMaxMagnitude)
         {
             networkEntity.position = data.movementVector;
         }
     }
 }
Exemplo n.º 4
0
 public ClientTag(ClientDataTags tag)
 {
     this.tag = (ushort)tag;
 }
Exemplo n.º 5
0
 public void UnregisterReadable(ClientDataTags tag)
 {
     readables.Remove(tag);
 }