private void CheckDeath() { Alive = m_health > 0; if (Alive) { return; } if (m_currDeathTime > DeathTime) { ExecuteEvents.Execute <ICustomMessageTarget> (gameObject, null, (x, y) => x.OnDeath()); if (GetComponent <BasicMovement> () && GetComponent <MGPlayer>() == null && GetComponent <BasicMovement> ().IsCurrentPlayer) { PauseGame.OnPlayerDeath(); } Destroy(gameObject); } GetComponent <SpriteRenderer>().color = Color.Lerp(Color.white, Color.black, (m_currDeathTime) / DeathTime); m_currDeathTime += Time.deltaTime; }
private void CheckDeath() { Alive = Health > 0; if (Alive) { return; } if (m_currDeathTime > DeathTime) { ExecuteEvents.Execute <ICustomMessageTarget> (gameObject, null, (x, y) => x.OnDeath()); if (GetComponent <BasicMovement> () && GetComponent <BasicMovement> ().IsCurrentPlayer) { PauseGame.OnPlayerDeath(); } if (DeathFX != null) { Instantiate(DeathFX, transform.position, Quaternion.identity); } Destroy(gameObject); } GetComponent <SpriteRenderer>().color = Color.Lerp(Color.white, Color.black, (m_currDeathTime) / DeathTime); m_currDeathTime += Time.deltaTime; }