diff --git a/Assets/Resources/Enemies/1/Enemy1V1.prefab b/Assets/Resources/Enemies/1/Enemy1V1.prefab index fc5cfcf..a2310a3 100644 --- a/Assets/Resources/Enemies/1/Enemy1V1.prefab +++ b/Assets/Resources/Enemies/1/Enemy1V1.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/1/Enemy1V2.prefab b/Assets/Resources/Enemies/1/Enemy1V2.prefab index 9c0bfe0..2dc1a03 100644 --- a/Assets/Resources/Enemies/1/Enemy1V2.prefab +++ b/Assets/Resources/Enemies/1/Enemy1V2.prefab @@ -172,19 +172,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: -4060921817738925561} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/1/Enemy1V3.prefab b/Assets/Resources/Enemies/1/Enemy1V3.prefab index 0d2ffd8..6c36ba0 100644 --- a/Assets/Resources/Enemies/1/Enemy1V3.prefab +++ b/Assets/Resources/Enemies/1/Enemy1V3.prefab @@ -256,19 +256,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1169561095041589923} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/2/Enemy2V1.prefab b/Assets/Resources/Enemies/2/Enemy2V1.prefab index de93794..5e27435 100644 --- a/Assets/Resources/Enemies/2/Enemy2V1.prefab +++ b/Assets/Resources/Enemies/2/Enemy2V1.prefab @@ -173,19 +173,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/2/Enemy2V2.prefab b/Assets/Resources/Enemies/2/Enemy2V2.prefab index 78cdbba..d120a01 100644 --- a/Assets/Resources/Enemies/2/Enemy2V2.prefab +++ b/Assets/Resources/Enemies/2/Enemy2V2.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/2/Enemy2V3.prefab b/Assets/Resources/Enemies/2/Enemy2V3.prefab index a1b7926..5104818 100644 --- a/Assets/Resources/Enemies/2/Enemy2V3.prefab +++ b/Assets/Resources/Enemies/2/Enemy2V3.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/3/Enemy3V1.prefab b/Assets/Resources/Enemies/3/Enemy3V1.prefab index b5d5a02..30a465f 100644 --- a/Assets/Resources/Enemies/3/Enemy3V1.prefab +++ b/Assets/Resources/Enemies/3/Enemy3V1.prefab @@ -173,19 +173,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/3/Enemy3V2.prefab b/Assets/Resources/Enemies/3/Enemy3V2.prefab index 072073d..de18a86 100644 --- a/Assets/Resources/Enemies/3/Enemy3V2.prefab +++ b/Assets/Resources/Enemies/3/Enemy3V2.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/3/Enemy3V3.prefab b/Assets/Resources/Enemies/3/Enemy3V3.prefab index 0cab492..13d34c7 100644 --- a/Assets/Resources/Enemies/3/Enemy3V3.prefab +++ b/Assets/Resources/Enemies/3/Enemy3V3.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/4/Enemy4V1.prefab b/Assets/Resources/Enemies/4/Enemy4V1.prefab index c652fd6..72e7682 100644 --- a/Assets/Resources/Enemies/4/Enemy4V1.prefab +++ b/Assets/Resources/Enemies/4/Enemy4V1.prefab @@ -173,19 +173,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/4/Enemy4V2.prefab b/Assets/Resources/Enemies/4/Enemy4V2.prefab index 611e25d..c3c1819 100644 --- a/Assets/Resources/Enemies/4/Enemy4V2.prefab +++ b/Assets/Resources/Enemies/4/Enemy4V2.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/4/Enemy4V3.prefab b/Assets/Resources/Enemies/4/Enemy4V3.prefab index 8918004..edcd94b 100644 --- a/Assets/Resources/Enemies/4/Enemy4V3.prefab +++ b/Assets/Resources/Enemies/4/Enemy4V3.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/5/Enemy5V1.prefab b/Assets/Resources/Enemies/5/Enemy5V1.prefab index c871edf..e60b1d2 100644 --- a/Assets/Resources/Enemies/5/Enemy5V1.prefab +++ b/Assets/Resources/Enemies/5/Enemy5V1.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/5/Enemy5V2.prefab b/Assets/Resources/Enemies/5/Enemy5V2.prefab index dd5a613..b677e31 100644 --- a/Assets/Resources/Enemies/5/Enemy5V2.prefab +++ b/Assets/Resources/Enemies/5/Enemy5V2.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/5/Enemy5V3.prefab b/Assets/Resources/Enemies/5/Enemy5V3.prefab index f2d71f2..8529e11 100644 --- a/Assets/Resources/Enemies/5/Enemy5V3.prefab +++ b/Assets/Resources/Enemies/5/Enemy5V3.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/6/Enemy6V1.prefab b/Assets/Resources/Enemies/6/Enemy6V1.prefab index f415033..d51db18 100644 --- a/Assets/Resources/Enemies/6/Enemy6V1.prefab +++ b/Assets/Resources/Enemies/6/Enemy6V1.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/6/Enemy6V2.prefab b/Assets/Resources/Enemies/6/Enemy6V2.prefab index d09ecbf..94120fc 100644 --- a/Assets/Resources/Enemies/6/Enemy6V2.prefab +++ b/Assets/Resources/Enemies/6/Enemy6V2.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Resources/Enemies/6/Enemy6V3.prefab b/Assets/Resources/Enemies/6/Enemy6V3.prefab index 462dc29..fae5c78 100644 --- a/Assets/Resources/Enemies/6/Enemy6V3.prefab +++ b/Assets/Resources/Enemies/6/Enemy6V3.prefab @@ -257,19 +257,7 @@ MonoBehaviour: maxHealth: 100 OnHealthZero: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2938081276856164938} - m_TargetAssemblyTypeName: HealthComponent, Assembly-CSharp - m_MethodName: SimpleKill - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] OnHealthChange: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs index f9a66c8..f763da9 100644 --- a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs +++ b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs @@ -11,7 +11,23 @@ public class EnemyAnimationHandler : MonoBehaviour if (animator != animator.enabled) animator.enabled = true; + GetComponent().OnHealthZero.AddListener(EnemyDie); } + void EnemyDie() + { + StartCoroutine(AnimationDie()); + } + + IEnumerator AnimationDie() + { + Strangle(); + yield return new WaitForSecondsRealtime(1f); + Die(); + while (animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1f) + yield return new WaitForEndOfFrame(); + Destroy(gameObject); + } + public void Strangle() { animator.SetTrigger("Die"); @@ -19,5 +35,6 @@ public class EnemyAnimationHandler : MonoBehaviour public void Die() { animator.SetTrigger("Die"); + } } diff --git a/Assets/Scripts/Player/HealthComponent.cs b/Assets/Scripts/Player/HealthComponent.cs index 2824f88..9c46ad2 100644 --- a/Assets/Scripts/Player/HealthComponent.cs +++ b/Assets/Scripts/Player/HealthComponent.cs @@ -51,7 +51,7 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver TakeDamage((int) Mathf.Round(squezeDamage * squezeDamageScalor)); } - public void SimpleKill() + public void EnemyKill() { Destroy(gameObject); }