Esempio n. 1
0
 public void RebuildAi()
 {
     Ai = null;
     if (!string.IsNullOrEmpty(aiFileName))
     {
         TextAsset aiCode = Resources.Load <TextAsset>(aiFileName);
         if (aiCode == null)
         {
             Debug.LogFormat("Unable to find code for {0}", aiFileName);
             return;
         }
         AgentBlackboard agentBlackboard = new AgentBlackboard(this);
         _compiler = _compiler ?? new BehaviourTreeCompiler <AgentBlackboard>();
         Ai        = _compiler.Compile(agentBlackboard, aiCode.text);
     }
 }
 public void CanDeserializeFromLisp()
 {
     BehaviourTree<BehaviourTreeTests.Blackboard> behaviourTree = CreateBehaviourTree();
     BehaviourTreeCompiler<BehaviourTreeTests.Blackboard> compiler = new BehaviourTreeCompiler<BehaviourTreeTests.Blackboard>();
     //string code = serializer.Convert(behaviourTree).ToCode();
     string code = behaviourTree.ToString();
     Debug.WriteLine(" in:" + code);
     LispParser lispParser = new LispParser();
     LispParser.Node parseTree = lispParser.Parse(code);
     //Debug.WriteLine("out:" + parseTree.ToCode());
     BehaviourTreeTests.Blackboard blackboard = new BehaviourTreeTests.Blackboard();
     BehaviourTree<BehaviourTreeTests.Blackboard> compiled = compiler.Compile(blackboard, parseTree);
     Debug.WriteLine("dep:" + compiled);
     compiled.Tick();
     compiled.Tick();
     compiled.Tick();
 }
        public void CanDeserializeFromLisp()
        {
            BehaviourTree <BehaviourTreeTests.Blackboard>         behaviourTree = CreateBehaviourTree();
            BehaviourTreeCompiler <BehaviourTreeTests.Blackboard> compiler      = new BehaviourTreeCompiler <BehaviourTreeTests.Blackboard>();
            //string code = serializer.Convert(behaviourTree).ToCode();
            string code = behaviourTree.ToString();

            Debug.WriteLine(" in:" + code);
            LispParser lispParser = new LispParser();

            LispParser.Node parseTree = lispParser.Parse(code);
            //Debug.WriteLine("out:" + parseTree.ToCode());
            BehaviourTreeTests.Blackboard blackboard = new BehaviourTreeTests.Blackboard();
            BehaviourTree <BehaviourTreeTests.Blackboard> compiled = compiler.Compile(blackboard, parseTree);

            Debug.WriteLine("dep:" + compiled);
            compiled.Tick();
            compiled.Tick();
            compiled.Tick();
        }
Esempio n. 4
0
 public void RebuildAi()
 {
     Ai = null;
     if (!string.IsNullOrEmpty(aiFileName))
     {
         TextAsset aiCode = Resources.Load<TextAsset>(aiFileName);
         if (aiCode == null)
         {
             Debug.LogFormat("Unable to find code for {0}", aiFileName);
             return;
         }
         AgentBlackboard agentBlackboard = new AgentBlackboard(this);
         _compiler = _compiler ?? new BehaviourTreeCompiler<AgentBlackboard>();
         Ai = _compiler.Compile(agentBlackboard, aiCode.text);
     }
 }
Esempio n. 5
0
 public void BuildAi(string code)
 {
     _compiler = _compiler ?? new BehaviourTreeCompiler<MovieBuffBlackboard>();
     Ai = _compiler.Compile(Blackboard, code);
 }
Esempio n. 6
0
 public void BuildAi(string code)
 {
     _compiler = _compiler ?? new BehaviourTreeCompiler <MovieBuffBlackboard>();
     Ai        = _compiler.Compile(Blackboard, code);
 }