Exemple #1
0
 public void loadGame(int SlotID)
 {
     if (FileBase.FileExist("Data/SaveData/Slot_" + (SlotID + 1) + ".tdf"))
     {
         Slots[SlotID] = TDF.Load("Data/SaveData/Slot_" + (SlotID + 1) + ".tdf");//TDF.LoadGZ
         var playerComp = GetComponent().player.GetComponent <Player>();
         var pos        = TDF.GetValueOfBlock(Slots[SlotID], "Game", "PlayerPos").Split(","[0]);
         var posX       = float.Parse(pos[0]);
         var posY       = float.Parse(pos[1]);
         var posZ       = float.Parse(pos[2]);
         player.position = new Vector3(posX, posY, posZ);
         var rot  = TDF.GetValueOfBlock(Slots[SlotID], "Game", "PlayerRot").Split(","[0]);
         var rotX = float.Parse(rot[0]);
         var rotY = float.Parse(rot[1]);
         var rotZ = float.Parse(rot[2]);
         playerComp.rotation = new Vector3(rotX, rotY, rotZ);
         player.rotation     = Quaternion.Euler(new Vector3(0, rotY, 0));
         Health = int.Parse(TDF.GetValueOfBlock(Slots[SlotID], "Game", "PlayerHealth"));
     }
     player.GetComponent <Player>().Move = true;
     SaveMenu.gameObject.SetActive(false);
     LoadMenu.gameObject.SetActive(false);
 }