Example #1
0
 public BehaverBridge(Behaver _behaverFront, BridgeHelperFactoryBridge _helperFactory)
 {
     helperFactory          = _helperFactory;
     behaverFront           = _behaverFront;
     matchAttributeCallback = (newAttributeGBlockPtr) => {
         try {
             var gBlock = NativeGrammarBlockUtils.GBlockPtrToGBlock(newAttributeGBlockPtr);
             var bf     = this.behaverFront;
             return((int)behaverFront.MatchAttribue(gBlock));
         } catch (System.Exception e) {
             Debug.LogError(e);
             return((int)AttributeMatchResult.NEUTRAL);
         }
     };
     setBehaviorCallback = (behaviorExpression, listener) => {
         try {
             var gBlock = NativeGrammarBlockUtils.GBlockPtrToGBlock(behaviorExpression);
             behaverFront.ReadyBehavior(GrammarBlockUtils.GBlockToBExpression(gBlock), new NativeBehaviorRequestListener(listener, helperFactory));
             Debug.Log("READY Set Behaver Front behavior: " + gBlock.cluster.blocks[1].unit.word);
         } catch (Exception e) {
             Debug.LogError(e);
         }
     };
     checkBehaviorCallback = (behaviorExpression, listener) => {
         try {
             var gBlock = NativeGrammarBlockUtils.GBlockPtrToGBlock(behaviorExpression);
             behaverFront.ReadyCheckBehavior(GrammarBlockUtils.GBlockToBExpression(gBlock), new NativeBehaviorCheckRequestListener(listener, helperFactory));
             Debug.Log("READY Check Behaver Front behavior: " + gBlock.cluster.blocks[1].unit.word);
         } catch (Exception e) { Debug.LogError(e); }
     };
 }
Example #2
0
 private extern static void ReadyBehaver(
     System.IntPtr agent, SinglePtrReturnIntCallback onAddAttributeCallback,
     TwoPtrCallback setBehaviorCallback, TwoPtrCallback checkBehaviorCallback
     );