fix: some factories not assigning fields correctly
This commit is contained in:
@@ -12,12 +12,15 @@ public class BehaviourFactory
|
||||
{
|
||||
T behaviour = TypeFactory.Get<T>(args);
|
||||
|
||||
stateEnable ??= TypeFactory.Get<StateEnable>();
|
||||
if (!stateEnable.Assign(behaviour))
|
||||
throw AssignFailedException.From(stateEnable, behaviour);
|
||||
|
||||
if (!behaviour.Assign(stateEnable))
|
||||
throw AssignFailedException.From(behaviour, stateEnable);
|
||||
if (stateEnable is not null)
|
||||
{
|
||||
if (!stateEnable.Assign(behaviour))
|
||||
throw AssignFailedException.From(stateEnable, behaviour);
|
||||
if (!behaviour.Assign(stateEnable))
|
||||
throw AssignFailedException.From(behaviour, stateEnable);
|
||||
}
|
||||
else
|
||||
StateEnableFactory.Instantiate(behaviour);
|
||||
|
||||
return behaviour;
|
||||
}
|
||||
|
Reference in New Issue
Block a user