public virtual void Update() { if (!_animationStarted) { return; } _animationElapsed -= Time.deltaTime; if (_animationElapsed >= 0) { return; } _animationStarted = false; _animationElapsed = 0; if (Alive) { return; } if (_deathAnimation) { MainAudioSource.PlayOneShot(ImpactClip); ResetEnemy(); _gameController.OnTargetDestroy(20f); _deathAnimation = false; } }
public void Init() { mMainAudio = new MainAudioSource(); mMainAudio.Init(); mFightAudio = new FightAudioSource(); mFightAudio.Init(); mAudioDic.Add(BackGroundType.Main, mMainAudio); mAudioDic.Add(BackGroundType.Fight, mFightAudio); }
public virtual void Show() { gameObject.SetActive(true); Alive = true; GetComponentInChildren <Animator>().SetBool("Dead", false); _animationElapsed = AnimationTime; _animationStarted = true; if (MainAudioSource != null && SpawnSound != null) { MainAudioSource.PlayOneShot(SpawnSound); } }
public IEnumerator Auto() { IsFiring = true; MainAudioSource.clip = AutoSound; MainAudioSource.Play(); while (IsFiring) { if (currentEnergy < energyDecrease) { IsFiring = false; } ShootBullet(); yield return(new WaitForSeconds(RecoilTime)); } MainAudioSource.clip = Shot; MainAudioSource.Stop(); }
public IEnumerator Burst() { if (energyDecrease < currentEnergy) { IsFiring = true; for (var i = 0; i < FiringCycle; i++) { if (FiringMode != 3) { MainAudioSource.PlayOneShot(Shot); } ShootBullet(); yield return(new WaitForSeconds(RecoilTime)); } IsFiring = false; } }
private void LockOnTargetSound() { MainAudioSource.PlayOneShot(TargetLockSound); }