Unity3D - 메모장

quest3dkorea.com


통계 위젯 (화이트)

18
38
139897


Shot Unity3D 스크립트

void FireAction() {
        if (firing) return;

        GameObject firesd = Instantiate(firesound, transform);
        Destroy(firesd, firesd.GetComponent<AudioSource>().clip.length);

        Rigidbody proj = Instantiate(projectile)as Rigidbody;
        proj.transform.localPosition = transform.position;
        proj.transform.localRotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0f,0f,0f));
        proj.velocity = shotpower * transform.forward;
        foreach (muzzleflashctrl mfc in MFC) {
            mfc.ExplosionParticle();
        }

        float tmpx = Random.Range(-3f, 3f);
        float tmpy = Random.Range(-3f, 3f);
        Vector3 currenttransform = transform.localRotation.eulerAngles;
        transform.localRotation = Quaternion.Euler(new Vector3(currenttransform.x + tmpx, currenttransform.y + tmpy, 0f));

        
        CancelInvoke("muzzletipreset");
        Invoke("muzzletipreset", 1f);
        
        Invoke("firebreak", waitsec);
        firing = true;
    }

덧글

댓글 입력 영역