Exemplo n.º 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);
             }
         }
     }
 }
Exemplo n.º 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();
             }
         }
     }
 }