Ejemplo n.º 1
0
 private void CheckForShooting()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit whatIHit;
         if (Physics.Raycast(transform.position, transform.forward, out whatIHit, Mathf.Infinity))
         {
             IDamageable damageable = whatIHit.collider.GetComponent <IDamageable>();
             if (damageable != null)
             {
                 damageable.AccioCaixa(0, Direccio(whatIHit.transform.InverseTransformDirection(whatIHit.normal))); // el numero depen de la posicio que porta l'arma
             }
         }
     }
 }