예제 #1
0
 /// <summary>
 /// Register new distributed object to this root
 /// </summary>
 /// <param name="newObject">New distributed object to be registered</param>
 public void RegisterObject(DistributedObject newObject)
 {
     if (registeredObjects.Contains(newObject))
     {
         return;
     }
     registeredObjects.Add(newObject);
     MessagesManager.RegisterObject(newObject);
     NewDistributedObjectRegistered?.Invoke(newObject);
 }
예제 #2
0
 /// <summary>
 /// Unregister distributed object from this root
 /// </summary>
 /// <param name="objectToUnregister">Distributed object to be unregistered</param>
 public void UnregisterObject(DistributedObject objectToUnregister)
 {
     if (!registeredObjects.Contains(objectToUnregister))
     {
         return;
     }
     MessagesManager.UnregisterObject(objectToUnregister);
     registeredObjects.Remove(objectToUnregister);
     DistributedObjectUnregistered?.Invoke(objectToUnregister);
 }
예제 #3
0
        /// <summary>
        /// Locate distributed object in the hierarchy parent objects
        /// </summary>
        private DistributedObject LocateParentObject()
        {
            var node = transform;

            while (node != null && parentObject == null)
            {
                parentObject = node.GetComponent <DistributedObject>();
                node         = node.parent;
            }

            return(parentObject);
        }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="prefabId">Instantiated object prefab id in the NetworkingConfig</param>
 /// <param name="distributedObject">Reference to instantiated distributed object component</param>
 public InstantiatedObjectData(int prefabId, DistributedObject distributedObject)
 {
     PrefabId          = prefabId;
     DistributedObject = distributedObject;
 }