예제 #1
0
파일: Action.cs 프로젝트: s76/testAI
        public override void Init(Reactor reactor)
        {
            base.Init(reactor);

            ComponentMethod cm = null;
            try {
                cm = reactor.FindMethod(actionMethod);
            } catch (ArgumentNullException e) {
                Debug.LogError("[Action Node] Could not find method :" + actionMethod + "\n" + NodeNamesInStack());
                throw e;
            }
            if(cm == null) {
                Debug.LogError("Could not load action method: " + actionMethod);
            } else {
                if(cm.methodInfo.ReturnType == typeof(IEnumerator<NodeResult>)) {
                    component = cm.component;
                    methodInfo = cm.methodInfo;
                    if( methodParams != null )
                    {
                        methodParams.ConvertParams(methodInfo);
                    }
                } else {
                    Debug.LogError("Action method has invalid signature: " + actionMethod);
                }
            }
        }
예제 #2
0
파일: Function.cs 프로젝트: s76/testAI
 public override void Init(Reactor reactor)
 {
     base.Init(reactor);
     var cm = reactor.FindMethod (functionName);
     if (cm == null) {
         Debug.LogError ("Could not load function method: " + functionName);
     } else {
         component = cm.component;
         methodInfo = cm.methodInfo;
     }
 }
예제 #3
0
파일: If.cs 프로젝트: s76/testAI
 public override void Init(Reactor reactor)
 {
     base.Init(reactor);
     var cm = reactor.FindMethod(conditionMethod);
     if(cm == null) {
         Debug.LogError("Could not load condition method: " + conditionMethod);
     } else {
         if(cm.methodInfo.ReturnType == typeof(bool)) {
             component = cm.component;
             methodInfo = cm.methodInfo;
         } else {
             Debug.LogError("Condition method has invalid signature: " + conditionMethod);
         }
     }
 }