Exemplo n.º 1
0
    protected void PlayDeathAnimation()
    {
        Animator animator = gameObject.GetComponent <Animator>();

        if (animator != null)
        {
            animator.SetTrigger("Death");
            Destroy(gameObject, 0.5f);
        }

        ParticleSystem particleSystem = gameObject.GetComponent <ParticleSystem>();

        if (particleSystem != null)
        {
            particleSystem.Play();
        }

        StoneSelfDestruct selfDestructScript = gameObject.GetComponent <StoneSelfDestruct>();

        if (selfDestructScript != null)
        {
            selfDestructScript.SelfDestruct();
            Destroy(gameObject, 1.0f);
        }
    }
Exemplo n.º 2
0
    protected void PlayDeathAnimation()
    {
        Animator animator = gameObject.GetComponent <Animator>();

        if (animator != null)
        {
            animator.SetTrigger("Death");
            Destroy(gameObject, 0.5f);
            return;
        }

        StoneSelfDestruct selfDestructScript = gameObject.GetComponent <StoneSelfDestruct>();

        if (selfDestructScript != null)
        {
            selfDestructScript.SelfDestruct();
            Destroy(gameObject, 1.0f);
        }
    }