예제 #1
0
파일: gun.cs 프로젝트: 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);
        }
    }