private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag != "Missile") { return; } Destroy(other.gameObject); isDead = true; timeOfDeath = Time.time; AudioManager.Instance.PlaySound("Explosion"); DeathDelegate?.Invoke(); }
public LifeController(float initialhealth, DeathDelegate deathEvent) { _maxHealth = initialhealth; currentHealth = _maxHealth; _deathDelegate = deathEvent; }
public void RemoveOnDeathCall(DeathDelegate _method) { OnDeathDelegateEvent -= _method; }
public void AddOnDeathCall(DeathDelegate _method) { OnDeathDelegateEvent += _method; }
public void registerDeathCallback(DeathDelegate callback) { this.callback = callback; }
public void UnregisterDeathListener(DeathDelegate d) { onDeath -= d; }
public void RegisterDeathListener(DeathDelegate d) { onDeath += d; }