Unity/Asset 분석

[Stylelized Projectile] 주요 Method

lipnus 2021. 6. 20. 13:46
반응형

 

발사체 발사 구현은

ECprojectileActor.csFire()

 

 

Code

    public void Fire()
    {
        // 카메라 쉐이킹
        if(CameraShake)
        {
            CameraShakeCaller.ShakeCamera();
        }

        // 총구 화염
        Instantiate(bombList[bombType].muzzleflare, spawnLocatorMuzzleFlare.position, spawnLocatorMuzzleFlare.rotation);

        // 탄피
        if (bombList[bombType].hasShells)
        {
            Instantiate(bombList[bombType].shellPrefab, shellLocator.position, shellLocator.rotation);
        }

        // 발사체
        Rigidbody rocketInstance;
        rocketInstance = Instantiate(bombList[bombType].bombPrefab, spawnLocator.position,spawnLocator.rotation) as Rigidbody;
        rocketInstance.AddForce(spawnLocator.forward * Random.Range(bombList[bombType].min, bombList[bombType].max));
        
        // 조준점 미세하게 흔들리는 효과
        if (MinorRotate)
        {
            RandomizeRotation();
        }
    }
반응형