using System.Collections; using System.Collections.Generic; using UnityEngine; public class cs01 : MonoBehaviour { public AudioClip au1, au2; private void OnMouseDown() { //顏色,透明度 GameObject.Find("Cube").GetComponent().material.color = new Color32(238, 38, 38, 100); //GameObject.Find("Cube").GetComponent().material.color = new Color(0, 1, 1, 0.4f); //縮小 GameObject.Find("Cube").transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); //音效 GameObject.Find("Cube").GetComponent().clip = au1; GameObject.Find("Cube").GetComponent().Play(); } private void OnMouseUp() { //顏色,透明度 GameObject.Find("Cube").GetComponent().material.color = new Color32(238, 38, 38, 255); //放大 GameObject.Find("Cube").transform.localScale = new Vector3(1, 1, 1); //音效 GameObject.Find("Cube").GetComponent().clip = au2; GameObject.Find("Cube").GetComponent().Play(); } }