Projectile Hit Sound Added
This commit is contained in:
parent
5b9d219464
commit
1ce2607602
|
@ -61,6 +61,39 @@ AudioMixerGroupController:
|
||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
m_BypassEffects: 0
|
m_BypassEffects: 0
|
||||||
|
--- !u!244 &-671410346139079125
|
||||||
|
AudioMixerEffectController:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_EffectID: 34608f7a4d3499e4bb4747a42c281232
|
||||||
|
m_EffectName: Attenuation
|
||||||
|
m_MixLevel: 2dc88c31b1b16cf4a91c0e7082919ee3
|
||||||
|
m_Parameters: []
|
||||||
|
m_SendTarget: {fileID: 0}
|
||||||
|
m_EnableWetMix: 0
|
||||||
|
m_Bypass: 0
|
||||||
|
--- !u!243 &-329335723480019797
|
||||||
|
AudioMixerGroupController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Projectile Hit
|
||||||
|
m_AudioMixer: {fileID: 24100000}
|
||||||
|
m_GroupID: dd1cda19a45ef294d8789a2af47afcf7
|
||||||
|
m_Children: []
|
||||||
|
m_Volume: 2cd261abac4698e4698da002d6c5a44a
|
||||||
|
m_Pitch: 1c7ec7a4f840018488827068ccd5f583
|
||||||
|
m_Send: 00000000000000000000000000000000
|
||||||
|
m_Effects:
|
||||||
|
- {fileID: -671410346139079125}
|
||||||
|
m_UserColorIndex: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_Solo: 0
|
||||||
|
m_BypassEffects: 0
|
||||||
--- !u!241 &24100000
|
--- !u!241 &24100000
|
||||||
AudioMixerController:
|
AudioMixerController:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -84,6 +117,7 @@ AudioMixerController:
|
||||||
- aec3f58549ce7b4478c453c40c434318
|
- aec3f58549ce7b4478c453c40c434318
|
||||||
- 88391c573bd80364c916040d855538c8
|
- 88391c573bd80364c916040d855538c8
|
||||||
- 08116dbf9979b7b4d8fcce772ec5ebfc
|
- 08116dbf9979b7b4d8fcce772ec5ebfc
|
||||||
|
- dd1cda19a45ef294d8789a2af47afcf7
|
||||||
name: View
|
name: View
|
||||||
m_CurrentViewIndex: 0
|
m_CurrentViewIndex: 0
|
||||||
m_TargetSnapshot: {fileID: 24500006}
|
m_TargetSnapshot: {fileID: 24500006}
|
||||||
|
@ -174,10 +208,11 @@ AudioMixerGroupController:
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Projectile
|
m_Name: Projectile Shot
|
||||||
m_AudioMixer: {fileID: 24100000}
|
m_AudioMixer: {fileID: 24100000}
|
||||||
m_GroupID: 88391c573bd80364c916040d855538c8
|
m_GroupID: 88391c573bd80364c916040d855538c8
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: -329335723480019797}
|
||||||
m_Volume: 2c4223d0669e7fa4a9bcd208d65d7586
|
m_Volume: 2c4223d0669e7fa4a9bcd208d65d7586
|
||||||
m_Pitch: 204d50d8b21017e41b743bceefd553b6
|
m_Pitch: 204d50d8b21017e41b743bceefd553b6
|
||||||
m_Send: 00000000000000000000000000000000
|
m_Send: 00000000000000000000000000000000
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
3,0.5,,0.2297,0.6172,0.1934,0.3,0.0275,,0.1354,,,,,,,,,,,,,,,,1,,,,,,,masterVolume
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4aa857170acca284b9ce4bc83d44dd99
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,22 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 59d0430fe628a2a4da8634f4c1e01c9b
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -14,6 +14,7 @@ GameObject:
|
||||||
- component: {fileID: 5084819958108693599}
|
- component: {fileID: 5084819958108693599}
|
||||||
- component: {fileID: 6837629660644296000}
|
- component: {fileID: 6837629660644296000}
|
||||||
- component: {fileID: 2154021251853475818}
|
- component: {fileID: 2154021251853475818}
|
||||||
|
- component: {fileID: 4197101675176415021}
|
||||||
m_Layer: 9
|
m_Layer: 9
|
||||||
m_Name: Basic Projectile
|
m_Name: Basic Projectile
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -137,7 +138,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 1451960c367cc30478631b32ba4f8356, type: 3}
|
m_Script: {fileID: 11500000, guid: 1451960c367cc30478631b32ba4f8356, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
damageOnContact: 50
|
|
||||||
--- !u!95 &2154021251853475818
|
--- !u!95 &2154021251853475818
|
||||||
Animator:
|
Animator:
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
|
@ -158,3 +158,99 @@ Animator:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorControllerStateOnDisable: 0
|
m_KeepAnimatorControllerStateOnDisable: 0
|
||||||
|
--- !u!82 &4197101675176415021
|
||||||
|
AudioSource:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2196707779812385060}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 4
|
||||||
|
OutputAudioMixerGroup: {fileID: -329335723480019797, guid: 55dad93ba7816e44c83798006fa0a277, type: 2}
|
||||||
|
m_audioClip: {fileID: 8300000, guid: 59d0430fe628a2a4da8634f4c1e01c9b, type: 3}
|
||||||
|
m_PlayOnAwake: 0
|
||||||
|
m_Volume: 1
|
||||||
|
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
|
||||||
|
|
|
@ -6,21 +6,24 @@ namespace AI
|
||||||
[RequireComponent(typeof(Rigidbody2D))]
|
[RequireComponent(typeof(Rigidbody2D))]
|
||||||
public class Projectile : MonoBehaviour, IPausable
|
public class Projectile : MonoBehaviour, IPausable
|
||||||
{
|
{
|
||||||
private Rigidbody2D _rigidbody = null;
|
public Rigidbody2D Rigidbody { get; private set; } = null;
|
||||||
|
private AudioSource audioSource = null;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_rigidbody = GetComponent<Rigidbody2D>();
|
Rigidbody = GetComponent<Rigidbody2D>();
|
||||||
|
audioSource = GetComponent<AudioSource>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVelocity(Vector2 velocity)
|
public void SetVelocity(Vector2 velocity)
|
||||||
{
|
{
|
||||||
_rigidbody.velocity = velocity;
|
Rigidbody.velocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCollisionEnter2D(Collision2D other)
|
private void OnCollisionEnter2D(Collision2D other)
|
||||||
{
|
{
|
||||||
ProjectilePool.Instance.Return(this);
|
ProjectilePool.Instance.Return(this);
|
||||||
|
audioSource.Play();
|
||||||
|
|
||||||
if (other.transform.CompareTag("Player"))
|
if (other.transform.CompareTag("Player"))
|
||||||
other.gameObject.GetComponent<Player.Death>().Die();
|
other.gameObject.GetComponent<Player.Death>().Die();
|
||||||
|
@ -41,7 +44,7 @@ namespace AI
|
||||||
|
|
||||||
private void UpdateRigidbody()
|
private void UpdateRigidbody()
|
||||||
{
|
{
|
||||||
_rigidbody.simulated = !IsPaused;
|
Rigidbody.simulated = !IsPaused;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,16 @@ namespace AI
|
||||||
if (projectile == null)
|
if (projectile == null)
|
||||||
projectile = Instantiate(prefab).GetComponent<Projectile>();
|
projectile = Instantiate(prefab).GetComponent<Projectile>();
|
||||||
|
|
||||||
projectile.gameObject.SetActive(true);
|
projectile.transform.position = Vector3.left * 10000;
|
||||||
|
projectile.Rigidbody.simulated = true;
|
||||||
|
|
||||||
return projectile;
|
return projectile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Return(Projectile projectile)
|
public void Return(Projectile projectile)
|
||||||
{
|
{
|
||||||
projectile.gameObject.SetActive(false);
|
projectile.Rigidbody.simulated = false;
|
||||||
|
projectile.transform.position = Vector3.right * 10000;
|
||||||
pool.Push(projectile);
|
pool.Push(projectile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue