void Die() { float minTime = 0.0f; if (animator != null) { if (HasParameter("ToDie", animator)) { animator.SetTrigger("ToDie"); minTime = 1.5f; } } // Fetch blood script and play explosion BloodExplosion blood = gameObject.GetComponent <BloodExplosion>(); if (blood != null) { blood.DeathExplode(); // Delay destroy until done StartCoroutine(DelayDestroy(Mathf.Max(minTime, blood.bloodDuration))); StartCoroutine(DestroyBlood(blood.bloodDuration)); } else { StartCoroutine(DelayDestroy(minTime)); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); BloodExplosion myScript = (BloodExplosion)target; if (GUILayout.Button("Death Explosion")) { myScript.DeathExplode(); } }