integrate sound
This commit is contained in:
parent
ffc3bbe283
commit
f54ce99f07
|
@ -133,7 +133,7 @@ Material:
|
|||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color1: {r: 0.3634766, g: 5.3403134, b: 0, a: 1}
|
||||
- _Color1: {r: 1.4539073, g: 21.361254, b: 0, a: 1}
|
||||
- _Color2: {r: 0.24509804, g: 0.3764706, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _FarColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
|
|
|
@ -29,6 +29,8 @@ public class EntityLives : MonoBehaviour
|
|||
|
||||
private void Die()
|
||||
{
|
||||
FMODUnity.RuntimeManager.PlayOneShot("event:/hit");
|
||||
|
||||
--lives;
|
||||
if (lives > 0)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using FMOD;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Debug = UnityEngine.Debug;
|
||||
using PlayerInput = Input.PlayerInput;
|
||||
public class PlayerShootInput : ShootInputBase
|
||||
{
|
||||
|
@ -25,6 +29,11 @@ public class PlayerShootInput : ShootInputBase
|
|||
_actions.Default.Shoot.performed -= Shoot;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(MakePewSounds());
|
||||
}
|
||||
|
||||
private void Shoot(InputAction.CallbackContext obj)
|
||||
{
|
||||
_isShooting = obj.ReadValueAsButton();
|
||||
|
@ -35,4 +44,19 @@ public class PlayerShootInput : ShootInputBase
|
|||
return _isShooting;
|
||||
}
|
||||
|
||||
private IEnumerator MakePewSounds()
|
||||
{
|
||||
var wait = new WaitForSeconds(0.02f);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (_isShooting)
|
||||
{
|
||||
FMODUnity.RuntimeManager.PlayOneShot("event:/shoot");
|
||||
}
|
||||
|
||||
yield return wait;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue