Terrain Engine 2D  1.10
A 2D Block Engine
TerrainEngine2D.Serialization Class Reference

Serializes terrain data for saving and loading More...

Static Public Member Functions

static string GetSaveDirectory ()
 
static string GetSavePath (string worldName)
 Get the save location for the voxel world files More...
 
static void SaveWorldData ()
 Save the world data to file (JSON) More...
 
static bool LoadWorldData (World world, string saveFolderPath)
 Load the world data from file More...
 
static void SaveBlockData ()
 Save the terrain data to file More...
 
static bool LoadBlockData (string saveFolderPath)
 Loads the saved data to the world More...
 
static bool IsValidWorldDirectory (string pathToDirectory)
 Check to see if the directory contains worldData and BlockData files More...
 
static bool DoesWorldDirectoryExist (string worldName)
 Check if a directory of a certain name exists More...
 
static bool DoesDirectoryExist (string path)
 Check if a directory exists More...
 

Static Public Attributes

static string SaveFolderName = "Worlds"
 Name of the folder containing the World files More...
 
static string WorldDataFileName = "WorldData.dat"
 Name of the file holding the world data More...
 
static string BlockDataFileName = "BlockData.bin"
 Name of the file holding the block data More...
 
static string DefaultSaveLocation = Application.persistentDataPath + "/" + SaveFolderName + "/"
 The default save location for builds More...
 
static string EditorSaveLocation = Application.streamingAssetsPath + "/" + SaveFolderName + "/"
 The default save location for testing in the editor More...
 
static bool WorldDataLoaded = false
 Whether world data has been loaded More...
 

Detailed Description

Serializes terrain data for saving and loading

Member Function Documentation

◆ DoesDirectoryExist()

static bool TerrainEngine2D.Serialization.DoesDirectoryExist ( string  path)
static

Check if a directory exists

Parameters
pathThe path to the directory
Returns
Returns true if that directory exists

◆ DoesWorldDirectoryExist()

static bool TerrainEngine2D.Serialization.DoesWorldDirectoryExist ( string  worldName)
static

Check if a directory of a certain name exists

Parameters
worldNameThe name of the directory
Returns
Returns true if that directory exists

◆ GetSaveDirectory()

static string TerrainEngine2D.Serialization.GetSaveDirectory ( )
static

◆ GetSavePath()

static string TerrainEngine2D.Serialization.GetSavePath ( string  worldName)
static

Get the save location for the voxel world files

Parameters
worldNameName of the world
Returns
Returns the save location

◆ IsValidWorldDirectory()

static bool TerrainEngine2D.Serialization.IsValidWorldDirectory ( string  pathToDirectory)
static

Check to see if the directory contains worldData and BlockData files

Parameters
pathToDirectoryThe path to the directory
Returns
Return true if it is a valid directory

◆ LoadBlockData()

static bool TerrainEngine2D.Serialization.LoadBlockData ( string  saveFolderPath)
static

Loads the saved data to the world

Parameters
saveFolderPathFile path of the world data folder
Returns
Returns true if the data is successfully loaded

◆ LoadWorldData()

static bool TerrainEngine2D.Serialization.LoadWorldData ( World  world,
string  saveFolderPath 
)
static

Load the world data from file

Parameters
worldReference to the World to set loaded data
saveFolderPathFile path of the world data folder
Returns
Returns true if the data was successfully loaded

◆ SaveBlockData()

static void TerrainEngine2D.Serialization.SaveBlockData ( )
static

Save the terrain data to file

◆ SaveWorldData()

static void TerrainEngine2D.Serialization.SaveWorldData ( )
static

Save the world data to file (JSON)

Member Data Documentation

◆ BlockDataFileName

string TerrainEngine2D.Serialization.BlockDataFileName = "BlockData.bin"
static

Name of the file holding the block data

◆ DefaultSaveLocation

string TerrainEngine2D.Serialization.DefaultSaveLocation = Application.persistentDataPath + "/" + SaveFolderName + "/"
static

The default save location for builds

◆ EditorSaveLocation

string TerrainEngine2D.Serialization.EditorSaveLocation = Application.streamingAssetsPath + "/" + SaveFolderName + "/"
static

The default save location for testing in the editor

◆ SaveFolderName

string TerrainEngine2D.Serialization.SaveFolderName = "Worlds"
static

Name of the folder containing the World files

◆ WorldDataFileName

string TerrainEngine2D.Serialization.WorldDataFileName = "WorldData.dat"
static

Name of the file holding the world data

◆ WorldDataLoaded

bool TerrainEngine2D.Serialization.WorldDataLoaded = false
static

Whether world data has been loaded


The documentation for this class was generated from the following file: