Beispiel #1
0
    public void DestroyShape()
    {
        ShapeDestroied?.Invoke(this);
        OnObjectDestroy?.Invoke(this);

        shape             = null;
        spriteMask.sprite = null;
        isSetupped        = false;
    }
Beispiel #2
0
    /// <summary>
    /// Funzione che esegue l'UnSetup dell'agent
    /// </summary>
    public void UnSetup()
    {
        groupCtrl = null;

        agentGravityCtrl.UnSetup();
        graphicCtrl.UnSetup();
        agentGroupCtrl.UnSetup();

        OnObjectDestroy?.Invoke(this);
    }
Beispiel #3
0
 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());
 }
Beispiel #6
0
 /// <summary>
 /// Funzione che rimanda in Pool il Bullet
 /// </summary>
 protected virtual void BulletDestroy()
 {
     collider.enabled = false;
     isSetupped       = false;
     OnObjectDestroy?.Invoke(this);
 }