public static void Load(int requestId, string path) { #if LOADFROM_BUNDLE || !UNITY_EDITOR || UIFROMBUNNDLE #else var go = AssetDatabase.LoadAssetAtPath <GameObject>(path); if (go == null) { BTLog.Error("load asset failed. requestId:{} path:{}", requestId, path); return; } GameObject.Instantiate(go); #endif }
private static AbsBehavior CreateBehavior(Hashtable table, int id) { AbsBehavior behavior = null; string type = table["$type"].ToString(); switch (type) { //顺序执行节点; case "NodeCanvas.BehaviourTrees.BTSequence": behavior = new BTSequence(table); break; //随机执行节点; case "NodeCanvas.BehaviourTrees.BTRandom": behavior = new BTRandom(table); break; //选择执行节点; case "NodeCanvas.BehaviourTrees.BTSelector": behavior = new BTSelector(table); break; //等级条件执行节点; case "NodeCanvas.BehaviourTrees.BTLevel": behavior = new BTLevel(table); break; //日志执行节点; case "NodeCanvas.BehaviourTrees.BTLog": behavior = new BTLog(table); break; default: break; } if (behavior != null) { behavior.Id = id; } return(behavior); }