Beispiel #1
0
        public static AIRunTimeBase MakeRuntime(AIRuntimeTaskData data, AI.Runtime.AIRunTimeTree tree)
        {
            AIRunTimeBase rst = null;

            switch (data.type)
            {
            case "Sequence":
                rst = new AIRuntimeSequence();
                break;

            case "Selector":
                rst = new AIRuntimeSelector();
                break;

            case "Inverter":
                rst = new AIRuntimeInverter();
                break;

            case "RotateSelf":
                rst = new AIRuntimeRotateSelf();
                break;

            case "MoveForward":
                rst = new AIRuntimeMoveForward();
                break;

            case "ResetTarget":
                rst = new AIRuntimeResetTarget();
                break;

            case "StatusRandom":
                rst = new AIRuntimeStatusRandom();
                break;

            case "FindTargetByDistance":
                rst = new AIRuntimeFindTargetByDistance();
                break;

            case "DoSelectNearest":
                rst = new AIRuntimeDoSelectNearest();
                break;

            case "RotateToTarget":
                rst = new AIRuntimeRotateToTarget();
                break;

            case "ValueDistance":
                rst = new AIRuntimeValueDistance();
                break;

            case "NavToTarget":
                rst = new AIRuntimeNavToTarget();
                break;

            case "StopNavMove":
                rst = new AIRuntimeStopNavMove();
                break;

            case "XAIActionSkill":
                rst = new AIRuntimeXAIActionSkill();
                break;

            case "Wait":
                rst = new AIRuntimeWait();
                break;

            case "ValueHP":
                rst = new AIRuntimeValueHP();
                break;

            case "Log":
                rst = new AIRuntimeLog();
                break;
            }
            if (rst != null)
            {
                rst.SetTree(tree); rst.Init(data);
            }
            return(rst);
        }
Beispiel #2
0
 public bool SetBehaviorTree(string name)
 {
     _tree_data      = AIRuntimeUtil.Load(name);
     _tree_behaviour = AIRuntimeFactory.MakeRuntime(_tree_data.task, this);
     return(true);
 }