/// <summary> /// Get the datas from the dataPath folder to get the navpoints and the triangles /// </summary> void LoadDatas() { TDS_NavDataSaver <CustomNavData> _loader = new TDS_NavDataSaver <CustomNavData>(); string _sceneName = SceneManager.GetActiveScene().name; string _directoryName = Path.Combine(Application.dataPath, "TDS_NavDatas"); CustomNavData _datas = _loader.LoadFile(_directoryName, _sceneName); navPoints = _datas.NavPointsInfo; triangles = _datas.TrianglesInfos; }
/// <summary> /// Get the nav points and save them in binary in a selected directory /// /// Sauvegarder les datas dans le dossier resources /// Au démarrage du jeu, si les datas ne sont pas dans le data path, on va les chercher dans le dosser resources pour les mettre dans le pdpath /// </summary> public void SaveDatas() { if (!Directory.Exists(SavingDirectory)) { Directory.CreateDirectory(SavingDirectory); } TDS_NavDataSaver <CustomNavData> _navDataSaver = new TDS_NavDataSaver <CustomNavData>(); CustomNavData _dataSaved = new CustomNavData(); _dataSaved.NavPointsInfo = navPoints; _dataSaved.TrianglesInfos = triangles; _navDataSaver.SaveFile(SavingDirectory, SceneManager.GetActiveScene().name, _dataSaved, ".txt"); }