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); } }; }
/// <summary>Chooses a random behaver currently in the scene</summary> /// <param name="excludedBehaver">Behaver that should be excluded</param> /// <returns>The random behaver</returns> public static Behaver GetRandomInScene(Behaver excludedBehaver) { return(GetRandomInScene(new List <Behaver>() { excludedBehaver })); }
// Define the moment where the observer considers changing its current pattern. private IEnumerator ThoughtPattern() { while (true) { Behaver random = GetRandomInScene(this); if (random != null) { focalTarget = GetRandomInScene(this).transform; } if (Random.Range(0, 1f) < 0.7f) { ChangePosition(); } if (Random.Range(0, 1f) < 0.05f) { StartCoroutine(TakePicture()); } yield return(new WaitForSeconds(ThoughtFrequency.Next())); } }
public void SayHelloLanguage(Behaver behaver) { Console.WriteLine("开始打招呼"); behaver(); }
void ConfigurableBehaviorAnalyzer.AddBehaver(Behaver behaver) { stdGiver.behavers.Add(behaver); }