public void DoPlay() { int playTemp; if (!playCooldown) { int index = (int)(AffectionManager.affectionValue / 10); if (index == 10) { index = 9; } playTemp = playValue [index]; AffectionManager.affectionValue += playTemp; pointAddition.addPoint(playTemp); playCooldown = true; lastPlayTime = DateTime.Now; PlayerPrefs.SetString("lastPlayTime", DateTime.Now.ToBinary().ToString()); PlayerPrefs.SetFloat("AffectionValue", AffectionManager.affectionValue); } PlayerPrefs.Save(); }
public void DoFeed() { int feedTemp; int index = (int)(AffectionManager.affectionValue / 10); if (index == 10) { index = 9; } feedTemp = feedValue [index]; if (!feedCooldown && feedable) { AffectionManager.affectionValue += feedTemp; pointAddition.addPoint(feedTemp); coinManager.AddCoin(5); feedCooldown = true; lastFeedTime = DateTime.Now; PlayerPrefs.SetString("LastFeedTime", DateTime.Now.ToBinary().ToString()); } PlayerPrefs.SetFloat("AffectionValue", AffectionManager.affectionValue); }
public void DoPet() { int petTemp; int index; petCount = PlayerPrefs.GetInt("lastPetCount", 0); TimeSpan ts = DateTime.Now - lastPetTime; Debug.Log(ts); if (ts.TotalMinutes >= 5) { petCount = 0; PlayerPrefs.SetInt("lastPetCount", petCount); petCooldown = false; } else { petCooldown = true; } if (!petCooldown) { petCooldown = true; lastPetTime = DateTime.Now; PlayerPrefs.SetString("lastPetTime", DateTime.Now.ToBinary().ToString()); } index = (int)(AffectionManager.affectionValue / 10); if (index == 10) { index = 9; } petTemp = (int)Mathf.Floor((float)petValue [index] - (float)petValue [index] / 4 * petCount); if (petTemp == 0) { petTemp = 1; } if (petTemp < 0) { anim.SetBool("isMad", true); StopCoroutine("ResetIdle"); StartCoroutine("ResetIdle"); petMad = true; } if (petTemp <= -4) { petTemp = -4; } AffectionManager.affectionValue += petTemp; pointAddition.addPoint(petTemp); PlayerPrefs.SetFloat("AffectionValue", AffectionManager.affectionValue); petCount++; PlayerPrefs.SetInt("lastPetCount", petCount); PlayerPrefs.Save(); Debug.Log(lastPetTime + " " + petCooldown + " " + petCount + " " + AffectionManager.affectionValue); }