Hello, @Kirillian
If you would like to create your own save/load system, it's a pretty much yes. But it should not confuse you that much, and it shouldn't be hard in this case. You just need to take all your variables that you want to save in a base class and create / reference it when you need. In your case :
public class PlayerData{
int playerHealth = 100;
int playerHealthLimit = 100;
int playerHunger = 0;
int playerThirst = 0;
int playerXp = 0;
int playerXpNextLvl = 50;
int playerLevel = 1;
int playerNextLevel = 2;
int Strenght = 0;
int Sight = 0;
int Speed = 0;
int Intelligence = 0;
int Magic = 0;
int Charisma = 0;
int Luck = 0;
int Defense = 0;
}
Then
public class TA_Player_Health_and_stuff : MonoBehaviour {
public TA_Player_Scripts playerScripts;
public PlayerData playerData;
void DamagePlayer(int damage)
{
playerData.playerHealth -= damage;
}
}
Of course this is not right way to damage player but I gave you an example on how to do it. Then you mark PlayerData class as Serializable and serialize/deserialize it. This will bring a lot of problems you will not be able to serialize somethings like Color and need to write a custom Color variable/property. Other than that you can use assets like [Easy Save][1] which will save you from bunch of head-hurting stuff. Choice is yours.
[1]: https://www.assetstore.unity3d.com/en/#!/content/768
↧