Ejemplo n.º 1
0
Archivo: gun.cs Proyecto: sayan-ux/maze
    void shoot()
    {
        mf.Play();
        RaycastHit hit;

        if (Physics.Raycast(fpscam.transform.position, fpscam.transform.forward, out hit, range))
        {
            Debug.Log(hit.transform.name);

            target tg = hit.transform.GetComponent <target>();

            if (tg != null)
            {
                tg.Takedamage(damage);
            }
            GameObject op = Instantiate(imef, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(op, 2f);
        }
    }