예제 #1
0
 public static void BuildMessage(InputTransformationMessage message)
 {
     foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> networkIdentity in NetworkServer.objects)
     {
         if (networkIdentity.Value.gameObject.GetComponent <Rigidbody>() != null || networkIdentity.Value.gameObject.GetComponent <ForceSynchronization>() != null)
         {
             StoredTransform transform = new StoredTransform();
             transform.networkId        = networkIdentity.Key.Value;
             transform.localPosition    = networkIdentity.Value.gameObject.transform.localPosition;
             transform.localEulerAngles = networkIdentity.Value.gameObject.transform.localEulerAngles;
             transform.localScale       = networkIdentity.Value.gameObject.transform.localScale;
             message.transforms.Add(transform);
         }
     }
 }
예제 #2
0
        public static void ProcessMessage(InputTransformationMessage message)
        {
            Dictionary <NetworkInstanceId, NetworkIdentity> networkIdentities = ClientScene.objects;

            foreach (StoredTransform transform in message.transforms)
            {
                NetworkInstanceId networkInstanceId = new NetworkInstanceId(transform.networkId);
                if (networkIdentities.ContainsKey(networkInstanceId))
                {
                    networkIdentities[networkInstanceId].transform.localPosition    = transform.localPosition;
                    networkIdentities[networkInstanceId].transform.localEulerAngles = transform.localEulerAngles;
                    networkIdentities[networkInstanceId].transform.localScale       = transform.localScale;
                }
            }
        }