void Update() { if (Input.GetMouseButtonDown(0) && buttonActive) { Invoke("HideButton", 0.1f); } Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hitInfo = Physics2D.GetRayIntersection(mouseRay); if (hitInfo.collider != null && !blocked) { Stand(); if (Input.GetMouseButton(0) || Input.GetKey(KeyCode.Space)) { hatsChanger.transform.position = new Vector3(-0.04f, -3.93f, 0); eyes.transform.localPosition = new Vector3(0, -0.01f, 0); eyebrows.transform.localPosition = new Vector3(0.0015f, 0, 0); SpriteChange(idle_clicked); OnFookStanding?.Invoke(this, EventArgs.Empty); } if (Input.GetMouseButtonUp(0) || Input.GetKeyUp(KeyCode.Space)) { Click(); hatsChanger.transform.position = new Vector3(-0.04f, -3.765f, 0); eyes.transform.localPosition = new Vector3(0, 0, 0); eyebrows.transform.localPosition = new Vector3(0.0015f, 0.0084f, 0); } if (Input.GetMouseButtonDown(1)) { if (hatsChanger.GetComponent <SpriteRenderer>().sprite != null) { hatResetButton.transform.Find("ResetText").GetComponent <Text>().text = "Reset"; hatResetButton.SetActive(true); buttonActive = true; } else { if (anger < 100) { hatResetButton.transform.Find("ResetText").GetComponent <Text>().text = "Let go"; hatResetButton.SetActive(true); buttonActive = true; } } } } else { Sit(); hatsChanger.transform.position = new Vector3(-0.04f, -3.765f, 0); } if (Input.GetKeyDown("i")) //Debug key { //Score.score += 100; } }
public void Stand() { FookAnim.enabled = false; SpriteChange(idle); OnFookStanding?.Invoke(this, EventArgs.Empty); }