added customization
This commit is contained in:
1 parent
1d7d176814
commit
51b5659f4a
116 files changed
+16093
-5
No files matched your search
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Saves
|
||||
{
|
||||
[Serializable]
|
||||
public class GameData
|
||||
{
|
||||
public int bodyMaterialIndex;
|
||||
public int faceMaterialIndex;
|
||||
public int hatIndex;
|
||||
|
||||
public Color platformColor = Color.white;
|
||||
public Color bonusColor = Color.white;
|
||||
|
||||
public string playerName = "Player";
|
||||
public int highScore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0ce86011fb84e229a6b0519f0cf3a6f
|
||||
timeCreated: 1772956848
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Saves
|
||||
{
|
||||
public static class SaveManager
|
||||
{
|
||||
private static string Path => Application.persistentDataPath + "/save.json";
|
||||
|
||||
public static void Save(GameData data)
|
||||
{
|
||||
var json = JsonUtility.ToJson(data, true);
|
||||
File.WriteAllText(Path, json);
|
||||
}
|
||||
|
||||
public static GameData Load()
|
||||
{
|
||||
if (!File.Exists(Path)) return new GameData();
|
||||
var json = File.ReadAllText(Path);
|
||||
return JsonUtility.FromJson<GameData>(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d20ff63563944482a848fae3a09386de
|
||||
timeCreated: 1772956882
|
||||
Reference in new issue
Block a user