Created
October 30, 2022 19:22
-
-
Save ProfessorSalty/6f0ca4a772792e1dd2a6e010d664e26f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static BehaviorTreeNode CreateBehaviorTreeNode( | |
SerializableBehaviorTreeNode serializableBehaviorTreeNode, Blackboard blackboard) | |
{ | |
var targetType = Type.GetType(serializableBehaviorTreeNode.assemblyQualifiedTypeName); | |
if (targetType == null) return null; | |
var constructor = | |
targetType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, | |
BehaviorTreeNodeConstructorProperties, null); | |
if (constructor == null) return null; | |
var constructorParameters = new object[] | |
{ | |
serializableBehaviorTreeNode.guid, serializableBehaviorTreeNode.pos, serializableBehaviorTreeNode.name, | |
blackboard | |
}; | |
return constructor.Invoke(constructorParameters) as BehaviorTreeNode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment