public bool genNote(int t, float dt) { if (t == 1) { sub = Instantiate(oriNote) as Note; sub2 = Instantiate(oriNote) as Note; sub3 = Instantiate(oriRect) as RectNote; sub.transform.localScale = fac.localScale; sub2.transform.localScale = fac.localScale; sub3.transform.localScale = fac.localScale; sub3.transform.localScale = new Vector3(sub3.transform.localScale.x, sub3.transform.localScale.y * speed * dt, sub3.transform.localScale.z); sub.transform.position = Gen.position; sub.transform.RotateAround(sub.transform.position, Vector3.forward, fac.localEulerAngles.z); sub2.transform.position = Gen.position; sub2.transform.Translate(new Vector3(0, sub3.transform.localScale.y, 0)); sub2.transform.RotateAround(sub.transform.position, Vector3.forward, fac.localEulerAngles.z); sub3.transform.position = Gen.position; sub3.transform.RotateAround(sub.transform.position, Vector3.forward, fac.localEulerAngles.z); sub.Type = 2; sub2.Type = 3; sub3.endNote = sub2; sub2.pre = sub3; sub.pre = sub3; sub.speed = speed * fac.localScale.y; sub2.speed = speed * fac.localScale.y; sub3.speed = speed * fac.localScale.y; return(true); } else { return(false); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Rect") { r = other.gameObject; re = r.GetComponent <RectNote>(); } }
void OnTriggerExit(Collider other) { //Debug.Log("Enter"); if (other.gameObject.tag == "Note") { RectNote r = other.gameObject.GetComponent <Note>().pre; if (r != null) { //Debug.Log("HEREDESTRO"); Destroy(r.endNote.gameObject); Destroy(r.gameObject); } Destroy(other.gameObject); l.setStr("Miss"); } }