Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ResetScriptables()
- {
- Debug.Log("Resetting Scriptables");
- for (int i = 0; i < objects.Count; i++)
- {
- switch (objects[i].GetType().FullName)
- {
- case "FloatValue":
- FloatValue ftmp = (FloatValue)objects[i];
- ftmp.RuntimeValue = ftmp.initialValue;
- Debug.Log("resetting FloatValue");
- break;
- case "BoolValue":
- BoolValue btmp = (BoolValue)objects[i];
- btmp.RuntimeValue = btmp.initialValue;
- Debug.Log("resetting BoolValue");
- break;
- case "Inventory":
- Inventory itmp = (Inventory)objects[i];
- itmp.coins = 0;
- itmp.maxMagic = 10;
- itmp.items.Clear();
- itmp.numberOfKeys = 0;
- Debug.Log("Inventory Reset");
- break;
- default:
- break;
- }
- if(File.Exists(Application.persistentDataPath +
- string.Format($"/{i}.dat")))
- {
- File.Delete(Application.persistentDataPath +
- string.Format($"/{i}.dat"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment