コード例 #1
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            for (int i = 0; i < assets.Count; i++)
            {
                DecisionAsset decisionAsset = assets[i] as DecisionAsset;
                BaseGraph     graphData     = decisionAsset.DeserializeGraph();

                //运行时数据结构
                DecisionTree model = new DecisionTree(decisionAsset.TreeId, SerializeHelp.SerializeToTree(graphData));

                string filePath = ECSDefPath.GetDecTreePath(decisionAsset.TreeId);
                IOHelper.WriteText(JsonMapper.ToJson(model), filePath);
                Debug.Log($"决策树生成成功>>>>{filePath}");
            }
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
コード例 #2
0
        public override void ExportGraph(List <InternalBaseGraphAsset> assets)
        {
            for (int i = 0; i < assets.Count; i++)
            {
                BehaviorAsset behaviorAsset = assets[i] as BehaviorAsset;
                BaseGraph     graphData     = behaviorAsset.DeserializeGraph();

                //运行时数据结构
                BehaviorTree model = new BehaviorTree(behaviorAsset.ReqId, SerializeHelp.SerializeToTree(graphData));

                string filePath = ECSDefPath.GetBevTreePath(behaviorAsset.ReqId);
                IOHelper.WriteText(JsonMapper.ToJson(model), filePath);
                Debug.Log($"行为树生成成功>>>>{filePath}");
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }