Ejemplo n.º 1
0
    public override void OnDeath()
    {
        int          i        = this.deathClips.Length;
        DestroyAfter timeBomb = this.gameObject.AddComponent <DestroyAfter>() as DestroyAfter;

        i = Random.Range(0, i - 1);

        if (charAnimator != null)
        {
            charAnimator.SetTrigger("Death");
        }
        this.GetComponent <HealthSystem>().enabled  = false;
        this.GetComponent <TargetTracker>().enabled = false;
        this.GetComponent <Collider>().enabled      = false;
        this.GetComponent <NavMeshAgent>().enabled  = false;
        this.GetComponent <BasicAttack>().enabled   = false;
        this.gameObject.transform.SetParent(cemetery.gameObject.transform);
        if (audioEmitter != null && this.deathClips.Length > 0)
        {
            audioEmitter.PlayOneShot(this.deathClips[i]);
        }
        recenser.RemoveMe();
        this.enabled   = false;
        timeBomb.delay = delayToDestroy;
    }