예제 #1
0
    public void Hit(ArrayList param)
    {
        int damage = (int)param[0];

        //데미지를 누적시킵니다.
        mHp -= damage;
        HudText(damage, transform.position + new Vector3(0, 3.1f, 0));

        mHpControl.Hit(damage);
        MakeEffect("Eff_Hit_Archer", (Vector3)param[1], transform);
        MakeEffect("Sound_Hit", Vector3.zero, transform);
        if (mHp <= 0)
        {
            //사망처리
            mStatus = Status.Dead;
            mHp     = 0;
            mAnimator.SetTrigger("Die");
            mGameManager.GameOver();
        }
    }
예제 #2
0
    //피격당할 경우 데미지 처리와 애니메이션 처리
    public void Hit(Vector3 hitPos)
    {
        GameObject    archer        = GameObject.Find("Archer");
        ArcherControl archercontrol = archer.GetComponent <ArcherControl>();

        int damage;

        archercontrol.isCritical();
        if (archercontrol.IsCritical)
        {
            damage = archercontrol.GetRandomDamage() * 2;
        }
        else
        {
            damage = archercontrol.GetRandomDamage();
        }
        mHp -= damage;
        mHpControl.Hit(damage);

        MakeEffect("Eff_Hit", hitPos + new Vector3(0.4f, 0.2f, 0), transform);
        MakeEffect("Sound_Hit", Vector3.zero, transform);

        HudText(damage, transform.position + new Vector3(0, .7f, 0), archercontrol.IsCritical);

        mAnimator.SetTrigger("Damage");

        //사망처리
        if (mHp <= 0)
        {
            mStatus           = Status.Dead;
            mHp               = 0;
            mCollider.enabled = false;
            mAnimator.SetTrigger("Die");
            mGameManager.SetEXP();
            mGameManager.ReAutoTarget();
            MakeEffect("Eff_Blood", transform.position + new Vector3(0, -1.5f, 0), GameObject.Find("FG_Depth0").transform);
            Destroy(gameObject, 1f);
        }
    }