예제 #1
0
    public void doDamage(int dp)
    {
        HP -= dp;
        Debug.Log(gameObject.tag + "get " + dp + "damage..");
        if (HP <= 0)
        {
            is_dead = true;
            Debug.Log(name + "is dead..");
            ani.SetBool("Dead", true);
            gameObject.tag = "Dead";
        }
        else
        {
            ani.SetBool("Damaged", true);
            float damage_time = GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).length;
            StartCoroutine(waiting_damaged(damage_time));
        }

        dc.showNumber(dp, transform.position);
        dc.show_damage(gameObject, init_hp, HP + dp, HP);
        ec.show_damage_effect(transform.position);
    }