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

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

            return(parentObject);
        }