示例#1
0
        private void ExportAIModels(string path)
        {
            foreach (AIModel aiModel in loader.aiModels)
            {
                // TODO: this is Rayman 2 specific for now :(
                string aiModelCSharp = AIModelExporter.AIModelToCSharp_R2(gameName + ".AIModels", aiModel);

                string filePath = Path.Combine(path, aiModel.name + ".cs");
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }

                using (StreamWriter aiModelFileStream = File.CreateText(filePath)) {
                    aiModelFileStream.Write(aiModelCSharp);
                    aiModelFileStream.Flush();
                    aiModelFileStream.Close();
                }

                /*if (aiModel.behaviors_normal != null) {
                 *  foreach (var b in aiModel.behaviors_normal) {
                 *      int i = 0;
                 *      foreach (var s in b.scripts) {
                 *          string filePathRaw =
                 *              Path.Combine(path, aiModel.name, "rule", b.name + "." + (i++) + ".osb");
                 *          if (File.Exists(filePathRaw)) {
                 *              File.Delete(filePathRaw);
                 *          }
                 *
                 *          Directory.CreateDirectory(Path.GetDirectoryName(filePathRaw));
                 *
                 *          File.WriteAllBytes(filePathRaw, s.GetNodeBytes());
                 *      }
                 *
                 *  }
                 * }
                 *
                 * if (aiModel.behaviors_reflex != null) {
                 *  foreach (var b in aiModel.behaviors_reflex) {
                 *      int i = 0;
                 *      foreach (var s in b.scripts) {
                 *          string filePathRaw = Path.Combine(path, aiModel.name, "reflex",
                 *              b.name + "." + (i++) + ".osb");
                 *          if (File.Exists(filePathRaw)) {
                 *              File.Delete(filePathRaw);
                 *          }
                 *
                 *          Directory.CreateDirectory(Path.GetDirectoryName(filePathRaw));
                 *
                 *          File.WriteAllBytes(filePathRaw, s.GetNodeBytes());
                 *      }
                 *
                 *  }
                 * }*/
            }
        }
示例#2
0
        private void ExportAIModels(string path)
        {
            foreach (AIModel aiModel in loader.aiModels)
            {
                // TODO: this is Rayman 2 specific for now :(
                string aiModelCSharp = AIModelExporter.AIModelToCSharp_R2(gameName + ".AIModels", aiModel);

                string filePath = Path.Combine(path, aiModel.name + ".cs");
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }

                using (StreamWriter aiModelFileStream = File.CreateText(filePath)) {
                    aiModelFileStream.Write(aiModelCSharp);
                    aiModelFileStream.Flush();
                    aiModelFileStream.Close();
                }
            }
        }