void ManageInput() { if (bottle.fillment.fillAmount == 1) { fingerReleased = true; PourAnimGO.SetActive(false); } if (Shop.activeSelf) { return; } if (Input.GetMouseButtonDown(0)) { InfoText.SetActive(false); } if (Input.GetMouseButton(0) && !fingerReleased && !resetingGame) { // Player is holding the screen --> fill bottle.Fill(0.2f, pourSpeed); dispenser.Dispense(0.2f, pourSpeed); pourAudio.enabled = true; firstGame = 1; PlayerPrefs.SetInt("first", firstGame); PlayerPrefs.Save(); Debug.Log(firstGame); ClickToStartAnim.SetTrigger("Fade"); DispenserAnim.SetBool("DispenserUp", false); DispenserAnim.SetBool("DispenserDown", true); PourAnimGO.SetActive(true); } if (Input.GetMouseButtonUp(0)) { pourAudio.enabled = false; fingerReleased = true; PourAnimGO.SetActive(false); } }
public void StartGame() { if (firstGame == 1) { InfoText.SetActive(false); } else if (firstGame == 0) { InfoText.SetActive(true); } Shop.SetActive(false); bottle = FindObjectOfType <BottleScript>(); currentFillLine = GameObject.Find("FillmentLine"); PourAnimGO.SetActive(false); HighScoreTxtGO.SetActive(false); endScreenOverlayPanel.SetActive(false); goalFillLineAnim.SetBool("LineSlideOut", true); if (FindObjectOfType <BottleScript>() != null) { PourAnimGO.GetComponent <Image>().color = bottle.liquidColor; // Set random position for the fill line the user has to reach. goalFillLine.transform.localPosition = new Vector3(-100, Random.Range(bottle.minAmount, bottle.maxAmount), 0); } //Get random dispense speed. SetDispenseSpeed(); fingerReleased = false; }