Ejemplo n.º 1
0
    private void Shoot()
    {
        // 크로스헤어 애니메이션
        theCrossHair.FireAnimation();

        //연사속도 재계산
        currentFireRate = currentGun.fireRate;

        // 총 발사
        // 1) MuzzlePlay ParticleSystem 실행
        currentGun.muzzleFlash.Play();

        // 2) Audio 실행
        PlaySE(currentGun.fire_Sound);

        // 3) 탄알집 총알 -1
        currentGun.currentBulletCount--;

        Hit();
        //오브젝트 풀링을 사용하면 렉이 다운되긴 하지만 그냥 구현

        // 4) 총기 발사 반동
        StopAllCoroutines(); // while 문 두개가 경쟁하는것을 막기위해 coroutine을 stop 시킴
        StartCoroutine(RetroActionCoroutine());
    }
Ejemplo n.º 2
0
 private void Shoot()
 {
     theCrossHair.FireAnimation();
     currentGun.currentBulletCount--;
     currentFireRate = currentGun.fireRate;
     PlaySE(currentGun.fire_Sound);
     currentGun.muzzleFlash.Play();
     Hit();
     StopAllCoroutines();
     //총기 반동
     StartCoroutine(RetroActionCoroutine());
 }
Ejemplo n.º 3
0
    // 총알 발사 이후 함수
    private void Shoot()
    {
        /* 총알을 발사할 경우 현재 총알 개수 감소 */
        --currentGun.currentBulletCount;
        /* 총 발사와 관련해 크로스 헤어 애니메이션 실행 */
        theCrossHair.FireAnimation();

        /* 한 발 연사 시간 초기화 */
        currentFireRate = currentGun.fireRate;
        /* 총격이 오브젝트에 맞는지 확인 */
        Hit();
        /* 발사와 동시에 총기 소음 실행 */
        PlaySE(currentGun.fireSound);
        /* 해당 Particle System 실행 */
        currentGun.muzzleFlash.Play();

        /* 정조준과 일반 조준의 반복문의 무한 반복을 막기 위함 */
        StopAllCoroutines();
        StartCoroutine(RetroActionCoroutine());
    }