43 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
namespace Engine.Core;
 | 
						|
 | 
						|
/// <summary>
 | 
						|
/// Represents a collector for the class type of <typeparamref name="T"/>.
 | 
						|
/// Provides mechanisms for tracking additions and removals, and notifies subscribers when such events occur on the assigned <see cref="IUniverse"/>.
 | 
						|
/// </summary>
 | 
						|
/// <typeparam name="T">The type of objects tracked by the collector.</typeparam>
 | 
						|
public interface IBehaviourCollector<T> : IHasUniverse where T : class
 | 
						|
{
 | 
						|
    /// <summary>
 | 
						|
    /// Event triggered when an object of type <typeparamref name="T"/> is added to the collector.
 | 
						|
    /// </summary>
 | 
						|
    Event<IBehaviourCollector<T>, BehaviourCollectedArguments> OnCollected { get; }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Event triggered when an object of type <typeparamref name="T"/> is removed from the collector.
 | 
						|
    /// </summary>
 | 
						|
    Event<IBehaviourCollector<T>, BehaviourRemovedArguments> OnRemoved { get; }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Amount of <typeparamref name="T"/> collected.
 | 
						|
    /// </summary>
 | 
						|
    int Count { get; }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Get a <typeparamref name="T"/> collected by it's index.
 | 
						|
    /// </summary>
 | 
						|
    T this[System.Index index] { get; }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Delegate for handling the <see cref="OnCollected"/> event.
 | 
						|
    /// </summary>
 | 
						|
    /// <param name="sender">The instance of the <see cref="IBehaviourCollector{T}"/> that triggered the event.</param>
 | 
						|
    /// <param name="behaviourCollected">The object of type <typeparamref name="T"/> that was added to the collector.</param>
 | 
						|
    readonly record struct BehaviourCollectedArguments(T BehaviourCollected);
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Delegate for handling the <see cref="OnRemoved"/> event.
 | 
						|
    /// </summary>
 | 
						|
    /// <param name="BehaviourRemoved">The object of type <typeparamref name="T"/> that was removed from the collector.</param>
 | 
						|
    readonly record struct BehaviourRemovedArguments(T BehaviourRemoved);
 | 
						|
}
 |