fixed enemy death overtime

This commit is contained in:
louishorlaville 2022-05-15 11:07:15 -04:00
parent dea031f804
commit a6591839dd
3 changed files with 6 additions and 1 deletions

View File

@ -418,6 +418,7 @@ MonoBehaviour:
landingPoint: {fileID: 0}
body: {fileID: 4916962407531476031}
flyingSpeed: 50
collider: {fileID: 774736357024529276}
--- !u!54 &3119225800646921348
Rigidbody:
m_ObjectHideFlags: 0

View File

@ -299,6 +299,7 @@ MonoBehaviour:
landingPoint: {fileID: 0}
body: {fileID: 6601239271941144557}
flyingSpeed: 50
collider: {fileID: 1871861664620959488}
--- !u!135 &1871861664620959488
SphereCollider:
m_ObjectHideFlags: 0

View File

@ -9,6 +9,7 @@ public class Enemy : MonoBehaviour
public Transform landingPoint;
public GameObject body;
public float flyingSpeed;
public SphereCollider collider;
private void Update()
{
@ -46,7 +47,9 @@ public class Enemy : MonoBehaviour
body.SetActive(false);
explosion.Emit(100);
explosionDebris.Emit(40);
yield return new WaitForSeconds(3f);
yield return new WaitForSeconds(.1f);
collider.enabled = false;
yield return new WaitForSeconds(2f);
Destroy(gameObject);
}
}