Compare commits
	
		
			1 Commits
		
	
	
		
			0bf38234c6
			...
			3b6a93d37a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3b6a93d37a | 
@@ -36,7 +36,10 @@ public class BehaviourController : BaseEntity, IBehaviourController
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public T AddBehaviour<T>(params object?[]? args) where T : class, IBehaviour
 | 
			
		||||
        => AddBehaviour(Factory.BehaviourFactory.Instantiate<T>(_universeObject, args));
 | 
			
		||||
    {
 | 
			
		||||
        T behaviour = Factory.BehaviourFactory.Instantiate<T>(args);
 | 
			
		||||
        return AddBehaviour(behaviour);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public T? GetBehaviour<T>()
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -4,10 +4,10 @@ namespace Syntriax.Engine.Core.Factory;
 | 
			
		||||
 | 
			
		||||
public class BehaviourFactory
 | 
			
		||||
{
 | 
			
		||||
    public static T Instantiate<T>(IUniverseObject universeObject, params object?[]? args) where T : class, IBehaviour
 | 
			
		||||
        => Instantiate<T>(universeObject, stateEnable: null, args);
 | 
			
		||||
    public static T Instantiate<T>(params object?[]? args) where T : class, IBehaviour
 | 
			
		||||
        => Instantiate<T>(stateEnable: null, args);
 | 
			
		||||
 | 
			
		||||
    public static T Instantiate<T>(IUniverseObject universeObject, IStateEnable? stateEnable, params object?[]? args)
 | 
			
		||||
    public static T Instantiate<T>(IStateEnable? stateEnable, params object?[]? args)
 | 
			
		||||
        where T : class, IBehaviour
 | 
			
		||||
    {
 | 
			
		||||
        T behaviour = TypeFactory.Get<T>(args);
 | 
			
		||||
@@ -18,8 +18,6 @@ public class BehaviourFactory
 | 
			
		||||
 | 
			
		||||
        if (!behaviour.Assign(stateEnable))
 | 
			
		||||
            throw AssignFailedException.From(behaviour, stateEnable);
 | 
			
		||||
        if (!behaviour.Assign(universeObject.BehaviourController))
 | 
			
		||||
            throw AssignFailedException.From(behaviour, universeObject.BehaviourController);
 | 
			
		||||
 | 
			
		||||
        return behaviour;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user