Respown & Save fix
This commit is contained in:
parent
71d7ff164a
commit
3e861d2ac3
@ -37,11 +37,15 @@ public class ResetPlayer : MonoBehaviour
|
|||||||
SceneInventoryDataManager.Instance.ClearListOfElements();
|
SceneInventoryDataManager.Instance.ClearListOfElements();
|
||||||
SceneTaskDataManager.Instance.ClearListOfElements();
|
SceneTaskDataManager.Instance.ClearListOfElements();
|
||||||
|
|
||||||
|
// Clear Account balance
|
||||||
|
AccountBalanceManager.Instance.SetAccountBalanceValue(0);
|
||||||
|
|
||||||
var saveController = GameObject.FindObjectOfType<SaveController>();
|
var saveController = GameObject.FindObjectOfType<SaveController>();
|
||||||
|
|
||||||
saveController.SavePlayerEquipmentItems();
|
saveController.SavePlayerEquipmentItems();
|
||||||
saveController.SavePlayerInventory();
|
saveController.SavePlayerInventory();
|
||||||
saveController.SavePlayerQuests();
|
saveController.SavePlayerQuests();
|
||||||
|
saveController.SaveAccountBalance();
|
||||||
|
|
||||||
// Player reset lvl, exp & health
|
// Player reset lvl, exp & health
|
||||||
var playerAgent = GameObject.FindGameObjectWithTag("Player");
|
var playerAgent = GameObject.FindGameObjectWithTag("Player");
|
||||||
@ -50,11 +54,13 @@ public class ResetPlayer : MonoBehaviour
|
|||||||
PlayerPrefs.SetFloat("health-S", PlayerPrefs.GetFloat("maxHealth"));
|
PlayerPrefs.SetFloat("health-S", PlayerPrefs.GetFloat("maxHealth"));
|
||||||
PlayerPrefs.SetFloat("health", PlayerPrefs.GetFloat("maxHealth"));
|
PlayerPrefs.SetFloat("health", PlayerPrefs.GetFloat("maxHealth"));
|
||||||
|
|
||||||
|
/*
|
||||||
playerAgent.GetComponent<Player>().exp = 0;
|
playerAgent.GetComponent<Player>().exp = 0;
|
||||||
PlayerPrefs.SetFloat("exp-S", 0);
|
PlayerPrefs.SetFloat("exp-S", 0);
|
||||||
|
|
||||||
playerAgent.GetComponent<Player>().lvl = 1;
|
playerAgent.GetComponent<Player>().lvl = 1;
|
||||||
PlayerPrefs.SetInt("lvl-S", 1);
|
PlayerPrefs.SetInt("lvl-S", 1);
|
||||||
|
*/
|
||||||
|
|
||||||
playerAgent.GetComponent<Player>().SaveCheckpoint();
|
playerAgent.GetComponent<Player>().SaveCheckpoint();
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,15 @@ public class RespawnScript : MonoBehaviour
|
|||||||
Scene scene = SceneManager.GetActiveScene();
|
Scene scene = SceneManager.GetActiveScene();
|
||||||
currentScene = scene.name;
|
currentScene = scene.name;
|
||||||
SceneManager.LoadScene(currentScene);
|
SceneManager.LoadScene(currentScene);
|
||||||
|
|
||||||
Player player = mainCh.GetComponent<Player>();
|
Player player = mainCh.GetComponent<Player>();
|
||||||
player.currentHealth = 10.0f;
|
|
||||||
PlayerPrefs.SetFloat("health", 10.0f);
|
// 1. health
|
||||||
PlayerPrefs.SetFloat("health-S", 10.0f);
|
player.currentHealth = PlayerPrefs.GetFloat("maxHealth");
|
||||||
|
PlayerPrefs.SetFloat("health", PlayerPrefs.GetFloat("maxHealth"));
|
||||||
|
PlayerPrefs.SetFloat("health-S", PlayerPrefs.GetFloat("maxHealth"));
|
||||||
|
|
||||||
|
// 2. exp & lvl
|
||||||
|
player.ManageLevels(PlayerPrefs.GetFloat("exp-S"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user