hit feedback particles

This commit is contained in:
louishorlaville 2022-05-15 16:25:30 -04:00
parent 4310b55ab1
commit 14f3a2dda5
8 changed files with 8491 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2530bb7d1c409324a8cbcd29b6ec106a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -548,6 +548,7 @@ Transform:
m_Children:
- {fileID: 9175352504942883267}
- {fileID: 378992053168571211}
- {fileID: 8607896124484432511}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -565,6 +566,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
explosion: {fileID: 6113853661072388009}
explosionDebris: {fileID: 6704497973935827627}
onHitExplosion: {fileID: 6699315643444341781}
landingPoint: {fileID: 0}
body: {fileID: 4916962407531476031}
flyingSpeed: 15
@ -954,6 +956,73 @@ MonoBehaviour:
m_ShadowLayerMask: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
--- !u!1001 &2390518803519823551
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4834061106301780288}
m_Modifications:
- target: {fileID: 138504292592014834, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_Name
value: OnHit
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
--- !u!198 &6699315643444341781 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9066894193389433514, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 2390518803519823551}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8607896124484432511 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 2390518803519823551}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2957969651565829379
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -215,6 +215,7 @@ Transform:
- {fileID: 946786364870826004}
- {fileID: 8720344212724865050}
- {fileID: 4075441662892148295}
- {fileID: 2720303500880571998}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -264,6 +265,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
explosion: {fileID: 1370012825294936109}
explosionDebris: {fileID: 1932237231617645871}
onHitExplosion: {fileID: 1030715603680260148}
landingPoint: {fileID: 0}
body: {fileID: 6601239271941144557}
flyingSpeed: 15
@ -10949,3 +10951,70 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
m_PrefabInstance: {fileID: 7986948521383717511}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8329902684326265502
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1002961339065835566}
m_Modifications:
- target: {fileID: 138504292592014834, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_Name
value: OnHit
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
--- !u!198 &1030715603680260148 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9066894193389433514, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 8329902684326265502}
m_PrefabAsset: {fileID: 0}
--- !u!4 &2720303500880571998 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 8329902684326265502}
m_PrefabAsset: {fileID: 0}

View File

@ -11008,6 +11008,7 @@ Transform:
- {fileID: 7257571198887076411}
- {fileID: 1197774401241834037}
- {fileID: 5842676399169191016}
- {fileID: 2282826750318303317}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -11057,11 +11058,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
explosion: {fileID: 8834084193154966018}
explosionDebris: {fileID: 8307756088670856960}
onHitExplosion: {fileID: 3757014927451604543}
landingPoint: {fileID: 0}
body: {fileID: 3605108994955462082}
flyingSpeed: 10
collider: {fileID: 8097907429543341359}
maxHP: 1
maxHP: 3
damage: 1
--- !u!135 &8097907429543341359
SphereCollider:
@ -11589,3 +11591,82 @@ ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9066894193389433514, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
m_PrefabInstance: {fileID: 526055833065377960}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5329883789169570965
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7237433744057047553}
m_Modifications:
- target: {fileID: 138504292592014834, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_Name
value: OnHit
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalScale.y
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalScale.z
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
--- !u!4 &2282826750318303317 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6222206415246453952, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 5329883789169570965}
m_PrefabAsset: {fileID: 0}
--- !u!198 &3757014927451604543 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9066894193389433514, guid: 2530bb7d1c409324a8cbcd29b6ec106a, type: 3}
m_PrefabInstance: {fileID: 5329883789169570965}
m_PrefabAsset: {fileID: 0}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ddbb88e84c9bf0246833fdf1636abeb8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,6 +5,7 @@ public class Enemy : MonoBehaviour
{
public ParticleSystem explosion;
public ParticleSystem explosionDebris;
public ParticleSystem onHitExplosion;
public Transform landingPoint;
public GameObject body;
@ -41,7 +42,16 @@ public class Enemy : MonoBehaviour
{
float destroyDelay = Mathf.Sqrt(distance)/(500/5);
_health -= turretDamage;
if (_health <= 0) StartCoroutine(Destroy(destroyDelay));
if (_health <= 0)
{
StartCoroutine(Destroy(destroyDelay));
}
else
{
Debug.Log("dmg");
StartCoroutine(playDmgParticles(destroyDelay));
}
}
private IEnumerator Destroy(float waitTime)
@ -58,6 +68,12 @@ public class Enemy : MonoBehaviour
Destroy(gameObject);
}
IEnumerator playDmgParticles(float waitTime)
{
yield return new WaitForSeconds(waitTime);
onHitExplosion.Emit(100);
}
public float DamageDealt()
{
return damage;