Exemplo n.º 1
0
    void Die()
    {
        alive = false;

        Transform t1 = transform.GetChild(1);

        SpriteRenderer sR = t1.GetComponent <SpriteRenderer>();

        if (sR.sortingLayerName != "OverWallUp" && sR.sortingLayerName != "BehindWallUp")
        {
            sR.sortingLayerName = overBloodLayer;
            sR.sortingOrder     = overBloodSortingOrder;
        }
        else
        {
            sR.sortingLayerName = overBloodUpLayer;
            sR.sortingOrder     = overBloodSortingOrder;
        }


        IAnimation anim = t1.GetComponent <IAnimation>();

        anim.Death();
        anim.DisableAnim();

        // Mesh is not a slave anymore. Mesh is a free elf.
        t1.SetParent(deathBodyHolder);

        Destroy(gameObject);
    }