コード例 #1
0
 virtual protected void Update()
 {
     if (clickToRing && Input.GetMouseButtonDown(0))
     {
         Ray mousePickRay = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(mousePickRay, out RaycastHit hit))
         {
             BellSynthesizer bell = hit.collider.gameObject.GetComponentInChildren <BellSynthesizer>();
             if (bell == bellSynthesizer && bell != null)
             {
                 Ring(hit.point, clickForce);
             }
         }
     }
 }
コード例 #2
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray mousePickRay = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(mousePickRay, out RaycastHit hit))
         {
             BellSynthesizer bell = hit.collider.gameObject.GetComponent <BellSynthesizer>();
             if (bell == null)
             {
                 bell = hit.collider.transform.gameObject.GetComponentInParent <BellSynthesizer>();
             }
             if (bell != null)
             {
                 bell.Play();
             }
         }
     }
 }