public void Save()
{
this.x = this.Player.transform.FindChild("Character").position.x;
this.y = this.Player.transform.FindChild("Character").position.z;
this.life = this.Player.GetComponent<SyncCharacter>().Life;
this.hunger = this.Player.GetComponent<SyncCharacter>().Hunger;
this.thirst = this.Player.GetComponent<SyncCharacter>().Thirst;
this.speed = this.Player.GetComponent<SyncCharacter>().Speed;
this.cdSpeed = this.Player.GetComponent<SyncCharacter>().CdSpeed;
this.jump = this.Player.GetComponent<SyncCharacter>().Jump;
this.cdJump = this.Player.GetComponent<SyncCharacter>().CdJump;
this.regen = this.Player.GetComponent<SyncCharacter>().Regen;
this.cdRegen = this.Player.GetComponent<SyncCharacter>().CdRegen;
this.poison = this.Player.GetComponent<SyncCharacter>().Poison;
this.cdPoison = this.Player.GetComponent<SyncCharacter>().CdPoison;
this.tutoProgress = this.Player.GetComponent<Tutoriel>().Progress;
this.isOp = this.Player.GetComponent<Social_HUD>().IsOp;
this.team = this.Player.GetComponent<Social_HUD>().Team;
using (StreamWriter file = new StreamWriter(this.path))
{
file.WriteLine(this.x.ToString() + '|' + this.y.ToString() + '|' + this.life.ToString() + '|' + this.hunger.ToString() + '|' + this.thirst.ToString() +
'|' + this.speed.ToString() + '|' + this.cdSpeed.ToString() + '|' + this.jump.ToString() + '|' + this.cdJump.ToString()
+ '|' + this.regen.ToString() + '|' + this.cdRegen.ToString() + '|' + this.poison.ToString() + '|' + this.cdPoison.ToString() + '|' + this.tutoProgress.ToString());
file.WriteLine(this.inventory);
file.WriteLine(this.isOp.ToString() + '|' + ((uint)this.team).ToString());
}
}
public void SaveGame(string path, string name) { //Save all the game data PlayerSave.SetString("save_name", name); PlayerSave.SetDateTime("save_time", System.DateTime.Now); //Save the rigidbodies for (int i = 0; i < rigidbodies.Length; i++) { //Save the position, rotation and scale PlayerSave.SetTransform("rigidbody_" + i + "_pos", rigidbodies[i].transform); //Save the colour PlayerSave.SetColor("rigidbody_" + i + "_color", rigidbodies[i].GetComponent <Renderer>().material.color); //Save the velocity PlayerSave.SetVector3("rigidbody_" + i + "_velocity", rigidbodies[i].velocity); //Save the angular velocity PlayerSave.SetVector3("rigidbody_" + i + "_angularVelocity", rigidbodies[i].angularVelocity); } //PlayerSave does not automaticly save at all. //The PlayerSaveManager saves on recompile and ApplicationQuit, but only if its in the current scene PlayerSave.SetSaveFile(path); PlayerSave.Save(); //Reload all the data RefreshSaveData(); }