void FixedUpdate() { smr.material.SetFloat("_Level", level); level -= Time.fixedDeltaTime; if (level <= 0) { instance = null; ai.Kill(); } }
public void Die() { if (instance != null) { instance.ai.Kill(); } instance = this; smr.material = mat; smr.material.SetFloat("_Level", 1); this.enabled = true; }