private void Update() { if (Player.lose == false) { player.gameObject.GetComponent <Rigidbody2D>().velocity -= player.gameObject.GetComponent <Rigidbody2D>().velocity; } if (SelectNowSphere.id == 1 && PlayerPrefs.GetString(Sphere1.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere1.GetComponent <MeshRenderer>().material; } else if (SelectNowSphere.id == 2 && PlayerPrefs.GetString(Sphere2.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere2.GetComponent <MeshRenderer>().material; } else if (SelectNowSphere.id == 3 && PlayerPrefs.GetString(Sphere3.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere3.GetComponent <MeshRenderer>().material; } else if (SelectNowSphere.id == 4 && PlayerPrefs.GetString(Sphere4.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere4.GetComponent <MeshRenderer>().material; } else if (SelectNowSphere.id == 5 && PlayerPrefs.GetString(Sphere5.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere5.GetComponent <MeshRenderer>().material; } }
void OnMouseUp() { transform.localScale = new Vector3(1f, 1f, 1f); if (id == 1 && PlayerPrefs.GetString(Sphere1.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere1.GetComponent <MeshRenderer>().material; } else if (id == 2 && PlayerPrefs.GetString(Sphere2.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere2.GetComponent <MeshRenderer>().material; } else if (id == 3 && PlayerPrefs.GetString(Sphere3.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere3.GetComponent <MeshRenderer>().material; } else if (id == 4 && PlayerPrefs.GetString(Sphere4.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere4.GetComponent <MeshRenderer>().material; } else if (id == 5 && PlayerPrefs.GetString(Sphere5.gameObject.name) == "Open") { mainSphere.GetComponent <MeshRenderer>().material = Sphere5.GetComponent <MeshRenderer>().material; } }
void OnMouseUp() { BuySound.Play(); transform.localScale = new Vector3(1f, 1f, 1f); if (PlayerPrefs.GetInt("Coins") >= 40 && SelectNowSphere.id == 1) { PlayerPrefs.SetString(Sphere1.GetComponent <SelectSphere>().nowSphere, "Open"); mainSphere.GetComponent <MeshRenderer>().material = Sphere1.GetComponent <MeshRenderer>().material; PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 40); selectBtn.SetActive(true); gameObject.SetActive(false); } else if (PlayerPrefs.GetInt("Coins") >= 150 && SelectNowSphere.id == 2) { PlayerPrefs.SetString(Sphere2.GetComponent <SelectSphere>().nowSphere, "Open"); mainSphere.GetComponent <MeshRenderer>().material = Sphere2.GetComponent <MeshRenderer>().material; PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 150); selectBtn.SetActive(true); gameObject.SetActive(false); } else if (PlayerPrefs.GetInt("Coins") >= 150 && SelectNowSphere.id == 3) { PlayerPrefs.SetString(Sphere3.GetComponent <SelectSphere>().nowSphere, "Open"); mainSphere.GetComponent <MeshRenderer>().material = Sphere3.GetComponent <MeshRenderer>().material; PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 150); selectBtn.SetActive(true); gameObject.SetActive(false); } else if (PlayerPrefs.GetInt("Coins") >= 150 && SelectNowSphere.id == 4) { PlayerPrefs.SetString(Sphere4.GetComponent <SelectSphere>().nowSphere, "Open"); mainSphere.GetComponent <MeshRenderer>().material = Sphere4.GetComponent <MeshRenderer>().material; PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 150); selectBtn.SetActive(true); gameObject.SetActive(false); } else if (PlayerPrefs.GetInt("Coins") >= 150 && SelectNowSphere.id == 5) { PlayerPrefs.SetString(Sphere5.GetComponent <SelectSphere>().nowSphere, "Open"); mainSphere.GetComponent <MeshRenderer>().material = Sphere5.GetComponent <MeshRenderer>().material; // PlayerPrefs.SetString("Now", Sphere5.GetComponent<SelectSphere>().nowSphere); PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 150); selectBtn.SetActive(true); gameObject.SetActive(false); } }