parent
							
								
									60919ef1f6
								
							
						
					
					
						commit
						1d1ba4fe4d
					
				
				 3 changed files with 56 additions and 81 deletions
			
			
		@ -1,37 +0,0 @@ | 
				
			||||
namespace gaemstone.ECS; | 
				
			||||
 | 
				
			||||
// TODO: Turn this into an interface? | 
				
			||||
public abstract class EntityBase<TReturn> | 
				
			||||
{ | 
				
			||||
	public abstract World World { get; } | 
				
			||||
 | 
				
			||||
	public abstract TReturn Add(Id id); | 
				
			||||
	public abstract TReturn Remove(Id id); | 
				
			||||
	public abstract bool Has(Id id); | 
				
			||||
 | 
				
			||||
	public TReturn Add(string symbol) => Add(World.LookupBySymbolOrThrow(symbol)); | 
				
			||||
	public TReturn Add(Entity relation, Entity target) => Add(Id.Pair(relation, target)); | 
				
			||||
 | 
				
			||||
	public TReturn Remove(string symbol) => Remove(World.LookupBySymbolOrThrow(symbol)); | 
				
			||||
	public TReturn Remove(Entity relation, Entity target) => Remove(Id.Pair(relation, target)); | 
				
			||||
 | 
				
			||||
	public bool Has(string symbol) => Has(World.LookupBySymbolOrThrow(symbol)); | 
				
			||||
	public bool Has(Entity relation, Entity target) => Has(Id.Pair(relation, target)); | 
				
			||||
 | 
				
			||||
	public abstract T? GetOrNull<T>(Id id) where T : unmanaged; | 
				
			||||
	public abstract T? GetOrNull<T>(Id id, T _ = null!) where T : class; | 
				
			||||
	public abstract T GetOrThrow<T>(Id id); | 
				
			||||
	public abstract ref T GetMut<T>(Id id) where T : unmanaged; | 
				
			||||
	public abstract ref T GetRefOrNull<T>(Id id) where T : unmanaged; | 
				
			||||
	public abstract ref T GetRefOrThrow<T>(Id id) where T : unmanaged; | 
				
			||||
	public abstract void Modified<T>(Id id); | 
				
			||||
 | 
				
			||||
	public abstract TReturn Set<T>(Id id, in T value) where T : unmanaged; | 
				
			||||
	public abstract TReturn Set<T>(Id id, T obj) where T : class; | 
				
			||||
 | 
				
			||||
	public TReturn ChildOf(Entity parent) => Add(World.ChildOf, parent); | 
				
			||||
 | 
				
			||||
	public TReturn Disable() => Add(World.Disabled); | 
				
			||||
	public TReturn Enable() => Remove(World.Disabled); | 
				
			||||
	public bool IsDisabled => Has(World.Disabled); | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue