Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     //
     if (Input.GetMouseButtonDown(0) &&
         !EventSystem.current.IsPointerOverGameObject())
     {
         //
         Vector3    punto = new Vector3(camara.pixelWidth / 2, camara.pixelHeight / 2, 0);
         Ray        ray   = camara.ScreenPointToRay(punto);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             GameObject     hitObject = hit.transform.gameObject;
             ReactiveTarget target    =
                 hitObject.GetComponent <ReactiveTarget>();
             if (target != null)
             {
                 target.reacciona();
             }
             else
             {
                 StartCoroutine(SphereIndicator(hit.point));
             }
         }
     }
 }