public void DestroyShape() { ShapeDestroied?.Invoke(this); OnObjectDestroy?.Invoke(this); shape = null; spriteMask.sprite = null; isSetupped = false; }
/// <summary> /// Funzione che esegue l'UnSetup dell'agent /// </summary> public void UnSetup() { groupCtrl = null; agentGravityCtrl.UnSetup(); graphicCtrl.UnSetup(); agentGroupCtrl.UnSetup(); OnObjectDestroy?.Invoke(this); }
public void ChangeHealth(int amount) { health += amount; OnChangeHealth?.Invoke(health); if (health > 0) { return; } OnObjectDestroy?.Invoke(); Destroy(gameObject); }
public virtual void Die() { carCrashSource.Play(); if (dropsAfterDeath && Random.value <= boosterDropChance) { DropBooster(); } if (dropsAfterDeath && Random.value <= partsDropChance) { DropParts(); } Destroy(gameObject); if (deathEffect != null) { Instantiate(deathEffect, transform.position, transform.rotation); } OnObjectDestroy?.Invoke(GetInstanceID()); }
private void OnBecameInvisible() { Destroy(gameObject); OnObjectDestroy?.Invoke(GetInstanceID()); }
/// <summary> /// Funzione che rimanda in Pool il Bullet /// </summary> protected virtual void BulletDestroy() { collider.enabled = false; isSetupped = false; OnObjectDestroy?.Invoke(this); }