BREAKING CHANGE: replaced universe objects with root universe object
This commit is contained in:
		@@ -32,5 +32,5 @@ public static class UniverseExtensions
 | 
			
		||||
    /// <typeparam name="T">Type to be searched through the <see cref="IUniverse"/>.</typeparam>
 | 
			
		||||
    /// <returns>The specified type if found; otherwise, throws <see cref="NotFoundException"/>.</returns>
 | 
			
		||||
    public static T FindRequired<T>(this IUniverse universe) where T : class
 | 
			
		||||
        => universe.Find<T>() ?? throw new NotFoundException($"{universe.GetType().FullName}({universe.Id}) does not contain any {nameof(IUniverseObject)} or {nameof(IBehaviour)} of type {typeof(T).FullName}");
 | 
			
		||||
        => universe.Root.BehaviourController.GetBehaviourInChildren<T>() ?? throw new NotFoundException($"{universe.GetType().FullName}({universe.Id}) does not contain any {nameof(IUniverseObject)} or {nameof(IBehaviour)} of type {typeof(T).FullName}");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,21 @@ public static class UniverseObjectExtensions
 | 
			
		||||
        return universeObject;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static IEnumerator<IUniverseObject> TraverseChildren(this IUniverseObject universeObject)
 | 
			
		||||
    {
 | 
			
		||||
        static IEnumerable<IUniverseObject> Traverse(IUniverseObject obj)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (IUniverseObject child in obj.Children)
 | 
			
		||||
            {
 | 
			
		||||
                yield return child;
 | 
			
		||||
                foreach (IUniverseObject descendant in Traverse(child))
 | 
			
		||||
                    yield return descendant;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return Traverse(universeObject).GetEnumerator();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #region Universe Object Search
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets a <see cref="IUniverseObject"/> of the specified type.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user