Code: Select all
public class Character : MonoBehaviour
{
public string characterName = new string("default");
public Dictionary<string, float> floatAttributes = new Dictionary<string, float>();
public Dictionary<string, bool> boolAttributes = new Dictionary<string, bool>();
public Dictionary<string, string> stringAttributes = new Dictionary<string, string>();
public void Initialize(string name, Dictionary<string, float> floats, Dictionary<string,bool> bools, Dictionary<string,string> strings)
{
characterName = name;
floatAttributes = floats;
boolAttributes = bools;
stringAttributes = strings;
}
}
Code: Select all
Character newChar = new Character();
newChar.characterName = "Boi";
newChar.floatAttributes.Add("strength", 15);
newChar.floatAttributes.Add("intelligence", 10);
newChar.boolAttributes.Add("isHuman", true);
newChar.stringAttributes.Add("Catch Phrase", "Deez Nutz");
ES3.Save(newChar.characterName, newChar);
Code: Select all
Character loadedChar = ES3.Load("Boi", new Character());