// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); touchPosition.z = 0f; //Debug.Log(touchPosition); if (rect.Contains(touchPosition)) { touchOnDown = true; } } if (Input.GetMouseButtonUp(0)) { Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); touchPosition.z = 0f; if (rect.Contains(touchPosition) && touchOnDown == true) { birdFlocker.ButtonPressed(message); if (isToggleType == true) { on = !on; if (on) { GetComponent <Renderer>().material.color = Color.blue; if (linkedOpposite != null) { linkedOpposite.GetComponent <Renderer>().material.color = new Color(114f / 255f, 1f, 0); linkedOpposite.on = !on; } } else { GetComponent <Renderer>().material.color = new Color(114f / 255f, 1f, 0); if (linkedOpposite != null) { linkedOpposite.GetComponent <Renderer>().material.color = Color.blue; linkedOpposite.on = !on; } } } } touchOnDown = false; } }
public static void PlayButtonClickedSound(ButtonBehaviour target) { if (CurrentUserInfo.IsSoundEnabled) { target.GetComponent <AudioSource>().Play(); } }