public void points() { Scors scors = HIghScors.load(); for (int i = 0; i < 10; i++) { text[i].text = (i + 1) + ": " + scors.hs[i]; } }
public static void SaveScore(enemy enemy) { BinaryFormatter format = new BinaryFormatter(); string path = Application.persistentDataPath + "/score.score"; FileStream stream = new FileStream(path, FileMode.Create); Scors scors = new Scors(enemy); format.Serialize(stream, scors); stream.Close(); }
void Start() { rb = GetComponent <Rigidbody2D>(); delay = Random.Range(mindelay, maxdelay); Scors scors = HIghScors.load(); for (int i = 0; i < 10; i++) { hss[i] = scors.hs[i]; } speed2 = speed; }
public static Scors load() { string path = Application.persistentDataPath + "/score.score"; if (File.Exists(path)) { BinaryFormatter format = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); Scors scors = format.Deserialize(stream) as Scors; stream.Close(); return(scors); } else { return(null); } }