add sounds to enemy dead and edit player for shot gun sounds

This commit is contained in:
Kotrba Filip 2020-02-02 10:14:37 +01:00
parent 7257b45303
commit d0ba3c340f
8 changed files with 187 additions and 17 deletions

View File

@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 4593238991022112296}
- component: {fileID: 5433357422100294214}
- component: {fileID: 305547904}
- component: {fileID: 1130753256873243990}
m_Layer: 0
m_Name: Enemy
m_TagString: Enemy
@ -112,6 +113,12 @@ MonoBehaviour:
damage: 10
attackRate: 2
actualHealth: 0
findRate: 1
deadSounds:
- {fileID: 8300000, guid: d4ff4e72509168f4fbb8fbbdb090139f, type: 3}
- {fileID: 8300000, guid: 1531017db51cc7947979d0883d237396, type: 3}
- {fileID: 8300000, guid: aa87a7af50cb95443a8a2c2cf67a3bc2, type: 3}
audio: {fileID: 1130753256873243990}
barricadeManager: {fileID: 0}
bodyParts:
- {fileID: 7695703802406861803}
@ -131,6 +138,102 @@ CapsuleCollider:
m_Height: 1.8
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!82 &1130753256873243990
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3545622996904709018}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 0.5
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &3163490712589900750
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -57,7 +57,8 @@ MonoBehaviour:
player: {fileID: 0}
hit: 0
audioSource: {fileID: -1682145434106595162}
shootSound: {fileID: 8300000, guid: f8179c48d63ecda4aad05d68f0c60de8, type: 3}
shootSound:
- {fileID: 8300000, guid: f8179c48d63ecda4aad05d68f0c60de8, type: 3}
--- !u!82 &-1682145434106595162
AudioSource:
m_ObjectHideFlags: 0
@ -69,8 +70,8 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_PlayOnAwake: 0
m_Volume: 0.5
m_Pitch: 1
Loop: 0
Mute: 0

View File

@ -7933,6 +7933,11 @@ PrefabInstance:
propertyPath: doorSound
value:
objectReference: {fileID: 8300000, guid: b5434979af9500f45b916a32c1c17b28, type: 3}
- target: {fileID: 8296172668023712160, guid: 907ad6f2d559dba4fa31dec92cfd86c0,
type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 532783939}
- target: {fileID: 8296172668023712162, guid: 907ad6f2d559dba4fa31dec92cfd86c0,
type: 3}
propertyPath: m_CarveOnlyStationary
@ -7953,7 +7958,8 @@ PrefabInstance:
propertyPath: m_PlayAutomatically
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: -2813215890939452537, guid: 907ad6f2d559dba4fa31dec92cfd86c0, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 907ad6f2d559dba4fa31dec92cfd86c0, type: 3}
--- !u!1001 &3187012868200475634
PrefabInstance:
@ -8265,11 +8271,21 @@ PrefabInstance:
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3259529005183415338, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 532783939}
- target: {fileID: 3520679535757810344, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3826653435697236619, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 532783939}
- target: {fileID: 3974723396677692687, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: m_StaticEditorFlags
@ -8430,6 +8446,11 @@ PrefabInstance:
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756661855765130475, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 532783939}
- target: {fileID: 7896311156661354352, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: m_StaticEditorFlags
@ -8455,6 +8476,11 @@ PrefabInstance:
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8723360381748974527, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 532783939}
- target: {fileID: 8993526177235387292, guid: 5322794fa1699704b8e50a14cef106b1,
type: 3}
propertyPath: m_StaticEditorFlags
@ -8470,7 +8496,11 @@ PrefabInstance:
propertyPath: m_LocalPosition.z
value: 0.232
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 9105452832208898671, guid: 5322794fa1699704b8e50a14cef106b1, type: 3}
- {fileID: 2369776044137917455, guid: 5322794fa1699704b8e50a14cef106b1, type: 3}
- {fileID: 4090411522576814766, guid: 5322794fa1699704b8e50a14cef106b1, type: 3}
- {fileID: 7851948758291723579, guid: 5322794fa1699704b8e50a14cef106b1, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 5322794fa1699704b8e50a14cef106b1, type: 3}
--- !u!1001 &7985979212702423926
PrefabInstance:
@ -8479,11 +8509,15 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 532783939, guid: 204c7411afdd01a478b1a1e25607d50c, type: 3}
propertyPath: m_Volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4607742650766078089, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: NightMusic
value:
objectReference: {fileID: 8300000, guid: 2842b38130c2ae343b9372edad7281bf, type: 3}
objectReference: {fileID: 8300000, guid: 2565765545848aa4daee89afd5ea506b, type: 3}
- target: {fileID: 4607742650766078089, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: DayMusic
@ -8507,7 +8541,7 @@ PrefabInstance:
- target: {fileID: 5981860502065413816, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: m_Volume
value: 0.106
value: 0.05
objectReference: {fileID: 0}
- target: {fileID: 6900128296167351179, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
@ -8524,6 +8558,21 @@ PrefabInstance:
propertyPath: guiManager
value:
objectReference: {fileID: 587476774}
- target: {fileID: 7985979212931499548, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: mouseSensitive
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7985979212931499548, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: speed
value: 5
objectReference: {fileID: 0}
- target: {fileID: 7985979212931499548, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: runSpeed
value: 10
objectReference: {fileID: 0}
- target: {fileID: 7985979212931499549, guid: 204c7411afdd01a478b1a1e25607d50c,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -12,6 +12,8 @@ public class EnemyManager : MonoBehaviour
public float actualHealth;
public float findRate = 1;
private float findTime = 1;
public List<AudioClip> deadSounds = new List<AudioClip>();
public AudioSource audio;
private NavMeshAgent navMeshAgent;
private PlayerManager player;
public BarricadeManager barricadeManager;
@ -33,6 +35,11 @@ public class EnemyManager : MonoBehaviour
DropBodyPart();
if (actualHealth <= 0)
{
if (deadSounds.Count > 0)
{
int rand = Random.Range(0, deadSounds.Count);
audio.PlayOneShot(deadSounds[rand]);
}
Destroy(transform.gameObject, 0.1f);
}
DestroyBarricades();

View File

@ -230,7 +230,7 @@ public class PlayerManager : MonoBehaviour
BlockManager blockManager = hit.transform.GetComponent<BlockManager>();
blockManager.Action();
}
else if (hit.transform.gameObject.layer == LayerMask.NameToLayer("BuildPlace") && Input.GetKeyDown(KeyCode.E) && buildTime < Time.time && barricadeMaterials > 0)
else if (hit.transform.gameObject.layer == LayerMask.NameToLayer("BuildPlace") && Input.GetKeyDown(KeyCode.E) && buildTime < Time.time && barricadeMaterials > 2)
{
BlockManager blockManager = spikes.GetComponent<BlockManager>();
if (blockManager != null)

View File

@ -17,7 +17,7 @@ public class WeaponManager : MonoBehaviour
public bool hit = false;
public AudioSource audioSource = new AudioSource();
public AudioClip shootSound;
public List<AudioClip> shootSound = new List<AudioClip>();
// Start is called before the first frame update
void Start()
@ -39,7 +39,11 @@ public class WeaponManager : MonoBehaviour
if (particleShoot != null && player.ammo > 1)
{
GameObject shoot = Instantiate(particleShoot, spawnShoot.transform.position, spawnShoot.transform.rotation);
audioSource.PlayOneShot(shootSound);
if (shootSound.Count > 0)
{
int rand = Random.Range(0, shootSound.Count);
audioSource.PlayOneShot(shootSound[rand]);
}
player.ammo -= 2;
Destroy(shoot, 0.3f);
fireTime = fireRate + Time.time;

View File

@ -334,7 +334,7 @@ PlayerSettings:
m_Automatic: 0
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 1
m_Automatic: 0
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0

View File

@ -18,7 +18,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 1
skinWeights: 1
textureQuality: 1
anisotropicTextures: 0
antiAliasing: 0
@ -40,6 +40,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
- serializedVersion: 2
name: Low
@ -53,7 +54,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
skinWeights: 2
textureQuality: 0
anisotropicTextures: 0
antiAliasing: 0
@ -75,6 +76,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
- serializedVersion: 2
name: Medium
@ -88,7 +90,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
skinWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
@ -110,6 +112,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
- serializedVersion: 2
name: High
@ -123,7 +126,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 2
skinWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
@ -145,6 +148,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
- serializedVersion: 2
name: Very High
@ -158,7 +162,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
skinWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
@ -180,6 +184,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
- serializedVersion: 2
name: Ultra
@ -193,7 +198,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
skinWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
@ -215,6 +220,7 @@ QualitySettings:
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: []
m_PerPlatformDefaultQuality:
Android: 2