void Update() { if (Input.GetKeyDown(KeyCode.Q)) { _songA.Play(5f); } if (Input.GetKeyDown(KeyCode.W)) { _songB.Play(5f); } if (Input.GetKeyDown(KeyCode.E)) { _songC.Play(5f); } if (Input.GetKeyDown(KeyCode.R)) { _songD.Play(5f); } if (Input.GetKeyDown(KeyCode.A)) { _soundA.PlayOneShot(transform.position); } if (Input.GetKeyDown(KeyCode.RightArrow)) { MusicManager.Instance.IncreaseLayerLevel(5f); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { MusicManager.Instance.DecreaseLayerLevel(5f); } if (Input.GetKeyDown(KeyCode.Space)) { MusicManager.Instance.StopMusic(2f); } }
private void OnTriggerEnter2D(Collider2D other) { // guard clause Player player = other.gameObject.GetComponent <Player>(); if (player == null) { return; } // found the player! call our abstract method and supporting feedback OnPickup(player); if (_pickupSFX != null) { _pickupSFX.PlayOneShot(transform.position); } if (_particlePrefab != null) { SpawnParticle(_particlePrefab); } Disable(); }
IEnumerator AttackRoutine(float beforeDelay, float activeDuration, float endDelay, SFXOneShot sfx, GameObject collisionObject, string animationName) { // start animation before hit, in case there's windup _playerAnimator.PlayAnimation(animationName); MeleeAttackState = MeleeAttackState.BeforeAttack; yield return(new WaitForSeconds(beforeDelay)); MeleeAttackState = MeleeAttackState.DuringAttack; AttackActivated?.Invoke(EquippedWeapon); //TODO: check/deal damage here CurrentWeaponCollision.SetActive(true); //_weaponAnimator.Play(animationName); sfx.PlayOneShot(transform.position); yield return(new WaitForSeconds(activeDuration)); CurrentWeaponCollision.SetActive(false); AttackDeactivated?.Invoke(); MeleeAttackState = MeleeAttackState.AfterAttack; //_weaponAnimator.Stop(); //TODO: this could be a window for followup/combo attacks yield return(new WaitForSeconds(endDelay)); MeleeAttackState = MeleeAttackState.NotAttacking; AttackCompleted?.Invoke(); }
private void PlayVFX() { if (_killParticlesPrefab != null) { ParticleSystem killParticles = Instantiate(_killParticlesPrefab, transform.position, Quaternion.identity); killParticles.Play(); } if (_killSFX != null) { _killSFX.PlayOneShot(transform.position); } }
protected virtual void PlayFX() { if (_impactVFX != null) { ParticleSystem vfx = Instantiate(_impactVFX, transform.position, Quaternion.identity); vfx.Play(); } if (_impactSFX != null) { _impactSFX.PlayOneShot(transform.position); } }
private void PlayFX() { if (_enteredSFX != null) { _enteredSFX.PlayOneShot(transform.position); } if (_enteredParticles != null) { ParticleSystem newParticles = Instantiate(_enteredParticles, transform.position, Quaternion.identity); newParticles.Play(); } }