private void Awake() { // PLAYER PREFS INIT BEGIN if (SPlayerPrefs.HasKey("Count")) { lvlCount = SPlayerPrefs.GetInt("Count"); } else { SPlayerPrefs.SetInt("Count", 0); } if (SPlayerPrefs.HasKey("Money")) { money = SPlayerPrefs.GetInt("Money"); } else { SPlayerPrefs.SetInt("Money", 0); } if (SPlayerPrefs.HasKey("TotalJumps")) { TotalJumps = SPlayerPrefs.GetInt("TotalJumps"); } else { SPlayerPrefs.SetInt("TotalJumps", 0); } if (SPlayerPrefs.HasKey("Attempts_" + lvlCount)) { lvlAttempts = SPlayerPrefs.GetInt("Attempts_" + lvlCount); } else { SPlayerPrefs.SetInt("Attempts_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Jumps_" + lvlCount)) { lvlJumps = SPlayerPrefs.GetInt("Jumps_" + lvlCount); } else { SPlayerPrefs.SetInt("Jumps_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Completed_" + lvlCount)) { lvlCompleted = SPlayerPrefs.GetInt("Completed_" + lvlCount); } else { SPlayerPrefs.SetInt("Completed_" + lvlCount, 0); } // PLAYER PREFS INIT END }
void Start() { if (SPlayerPrefs.HasKey("Money")) { money = SPlayerPrefs.GetInt("Money"); } else { SPlayerPrefs.SetInt("Money", 0); } }
void Start() { jumps = GameObject.Find("Jumps"); attempts = GameObject.Find("Attempts"); percent = GameObject.Find("Percentage"); playOrBuy = GameObject.Find("PlayOrBuy"); //Min amount of jumps to complete the lvl lvlCount = SPlayerPrefs.GetInt("Count"); //Первые две карты изначально открыты SPlayerPrefs.SetInt("Buyed_0", 1); SPlayerPrefs.SetInt("Buyed_1", 1); SPlayerPrefs.Save(); if (SPlayerPrefs.HasKey("Jumps_" + lvlCount)) { lvlJumps = SPlayerPrefs.GetInt("Jumps_" + lvlCount); } else { SPlayerPrefs.SetInt("Jumps_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Attempts_" + lvlCount)) { lvlAttempts = SPlayerPrefs.GetInt("Attempts_" + lvlCount); } else { SPlayerPrefs.SetInt("Attempts_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Progress_" + lvlCount)) { progress = SPlayerPrefs.GetFloat("Progress_" + lvlCount); } else { SPlayerPrefs.SetFloat("Progress_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Buyed_" + lvlCount)) { lvlBuyed = SPlayerPrefs.GetInt("Buyed_" + lvlCount); } else { SPlayerPrefs.SetInt("Buyed_" + lvlCount, 0); } if (SPlayerPrefs.HasKey("Money")) { money = SPlayerPrefs.GetInt("Money"); } else { SPlayerPrefs.SetInt("Money", 0); } }
void Start() { rb = gameObject.GetComponentInParent <Rigidbody2D>(); if (!SPlayerPrefs.HasKey("DigitStateItemIsSelected")) { SPlayerPrefs.SetInt("DigitStateItemIsSelected", 0); } cnt = SPlayerPrefs.GetInt("DigitStateItemIsSelected"); for (int i = 0; i < skins.Length; i++) { skins[i] = Resources.Load <Sprite>("Sprites/skins/skin" + i); } //cnt = 17; gameObject.GetComponent <SpriteRenderer>().sprite = skins[cnt]; }
//private string state = "init"; void Start() { textButton = GameObject.Find("TextButton"); tnt = GameObject.Find("TntButton"); if (!SPlayerPrefs.HasKey("Money")) { SPlayerPrefs.SetInt("Money", 0); } money = SPlayerPrefs.GetInt("Money"); //SPlayerPrefs.SetString(STATEITEM + "1", "Buy"); if (gameObject != tnt) { visualStateSelected = transform.GetChild(1).gameObject; visualStateLock = transform.GetChild(2).gameObject; itemCount = 0; while (gameObject.name != ("Item" + itemCount)) { if (itemCount++ > 31) { break; } } if (flagOnceInitFirstItem) { flagOnceInitFirstItem = false; if (!SPlayerPrefs.HasKey(STATEITEM + "0")) { SPlayerPrefs.SetString(STATEITEM + "0", "Selected"); SPlayerPrefs.Save(); } } if (!SPlayerPrefs.HasKey(STATEITEM + itemCount)) { SPlayerPrefs.SetString(STATEITEM + itemCount, "Buy"); } if (itemCount == 10) { gameObject.GetComponent <Image>().color = Color.yellow; } } }
void Start() { if (SPlayerPrefs.HasKey("Count")) { lvlCount = SPlayerPrefs.GetInt("Count"); } else { SPlayerPrefs.SetInt("Count", 0); } if (SPlayerPrefs.HasKey("Progress_" + lvlCount)) { progress = SPlayerPrefs.GetFloat("Progress_" + lvlCount); } else { SPlayerPrefs.SetFloat("Progress_" + lvlCount, 0); } player = GameObject.Find("Player").transform; }
void Start() { if (SPlayerPrefs.HasKey("Count")) { lvlCount = SPlayerPrefs.GetInt("Count"); } else { SPlayerPrefs.SetInt("Count", 0); } if (SPlayerPrefs.HasKey("Attempts_" + lvlCount)) { Attempts = SPlayerPrefs.GetInt("Attempts_" + lvlCount); } else { SPlayerPrefs.SetInt("Attempts_" + lvlCount, 0); } GetComponent <Text>().text = "Attempt " + SPlayerPrefs.GetInt("Attempts_" + lvlCount).ToString(); }