void CreateMap()
        {
            string rootPath      = IOHelpers.RequireFolder(ROOT_FOLDER);
            string mapFolderPath = IOHelpers.RequireFolder(rootPath, MAP_FOLDER);
            string mapPath       = IOHelpers.GetAvailableAssetPath(mapFolderPath, MAP_NAME);
            string configName;

            switch (caveGenType)
            {
            case CaveGeneratorUI.CaveGeneratorType.ThreeTiered:
                configName = THREE_TIER_CONFIG_NAME;
                break;

            case CaveGeneratorUI.CaveGeneratorType.RockOutline:
                configName = ROCK_CAVE_CONFIG_NAME;
                break;

            default:
                throw CaveGenTypeException;
            }
            string             property       = string.Format("{0}.{1}", configName, MAP_GEN_NAME);
            SerializedProperty mapGenProperty = serializedObject.FindProperty(property);
            var mapGen  = (MapGenModule)mapGenProperty.objectReferenceValue;
            var map     = mapGen.Generate();
            var texture = map.ToTexture();

            IOHelpers.SaveTextureAsPNG(texture, mapPath);
        }
Пример #2
0
        void SaveChart()
        {
            string folderPath = NodeEditorSettings.PathToChartFolder;
            string chartPath  = IOHelpers.GetAvailableAssetPath(folderPath, string.Format("{0}.asset", chart.name));

            AssetDatabase.CreateAsset(chart, chartPath);
        }
Пример #3
0
        void SaveModule()
        {
            var    compoundModule = BuildModule();
            string folderPath     = NodeEditorSettings.PathToModuleFolder;
            string modulePath     = IOHelpers.GetAvailableAssetPath(folderPath, SAVED_MODULE_NAME);

            AssetDatabase.CreateAsset(compoundModule, modulePath);
        }
Пример #4
0
        static void Duplicate(MenuCommand command)
        {
            Module module      = (Module)command.context;
            string folderPath  = IOHelpers.GetFolderContainingAsset(module);
            string path        = IOHelpers.GetAvailableAssetPath(folderPath, module.name + ".asset");
            Module copiedAsset = module.CopyDeep();

            ScriptableObjectHelpers.SaveCompoundScriptableObject(copiedAsset, path);
        }
Пример #5
0
        void SaveMap()
        {
            var       compoundModule = BuildModule();
            string    folderPath     = NodeEditorSettings.PathToMapFolder;
            Texture2D texture        = compoundModule.Generate().ToTexture();
            string    texturePath    = IOHelpers.GetAvailableAssetPath(folderPath, SAVED_TEXTURE_NAME);

            IOHelpers.SaveTextureAsPNG(texture, texturePath);
        }
        static void SaveAsPNG(MenuCommand command)
        {
            var       module      = (MapGenModule)command.context;
            string    folderPath  = IOHelpers.GetFolderContainingAsset(module);
            Texture2D texture     = module.Generate().ToTexture();
            string    name        = string.Format("{0}{1}.png", module.name, MapImporter.MAP_SUBSTRING);
            string    texturePath = IOHelpers.GetAvailableAssetPath(folderPath, name);

            IOHelpers.SaveTextureAsPNG(texture, texturePath);
        }
        void CreateMap()
        {
            string rootPath      = IOHelpers.RequireFolder(ROOT_FOLDER);
            string mapFolderPath = IOHelpers.RequireFolder(rootPath, MAP_FOLDER);
            string mapPath       = IOHelpers.GetAvailableAssetPath(mapFolderPath, MAP_NAME);
            var    mapGen        = GetMapGenModule();
            var    map           = mapGen.Generate();
            var    texture       = map.ToTexture();

            IOHelpers.SaveTextureAsPNG(texture, mapPath);
        }