public static void SaveCreature(Creature c) { Creature_Stats creature = c.myStats; BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/" + creature.creatureName + ".creature"); bf.Serialize(file, creature); file.Close(); }
public static Creature_Stats LoadCreature(string s) { if (File.Exists(Application.persistentDataPath + "/" + s + ".creature")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + s + ".creature", FileMode.Open); Creature_Stats c = (Creature_Stats)bf.Deserialize(file); file.Close(); File.Delete(Application.persistentDataPath + "/" + s + ".creature"); return(c); } else { return(null); } }
public void extractData() {//(wip) this function will gather up all the needed data GameObject g; g = Grid_Turn_Manager.turnOrder[Grid_Turn_Manager.currentTurn]; Creature_Stats Creature_Stats = g.GetComponent <Creature_Stats>(); Name = Creature_Stats.Name; currentX = Creature_Stats.currentX; currentY = Creature_Stats.currentY; currentZ = Creature_Stats.currentZ; numOfMaxActions = Creature_Stats.numOfMaxActions; numOfAvailibleActions = numOfMaxActions; speed = Creature_Stats.speed; actions = Creature_Stats.actions; planActions(); }