Exemple #1
0
    void Death()
    {
        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;
        }

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

        anim.Death();

        t1.parent = null;

        Destroy(gameObject);
    }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Weapon")
     {
         dead();
         anim.Death();
         Time.timeScale = 0.001f;
     }
 }
Exemple #3
0
 public void Damage()
 {
     if (Health < 1)
     {
         return;
     }
     Health--;
     UIManager.Instance.UpdateLive(Health);
     if (Health < 1)
     {
         _playerAnim.Death();
     }
 }