コード例 #1
0
    public void DecreaseHpByWolf(int cnt, WolfAgent wolf = null)
    {
        if (state == EnemyState.die || state == EnemyState.hit)
        {
            return;
        }
        hp      -= cnt;
        oldState = state;
        state    = EnemyState.hit;
        velocity = 0;
        EnemyExplosion enemyExplosion = GetComponentInChildren <EnemyExplosion>();

        enemyExplosion.isEnemyAtked = true;
        if (wolf != null)
        {
            enemiesManager.AtkReward(atk, wolf);
            Runaway(wolf.gameObject);
        }

        if (hp <= 0)
        {
            //Debug.Log("주겄당!!");
            if (wolf != null)
            {
                enemiesManager.DieReward(wolf);
            }
            state       = EnemyState.die;
            oldRotation = transform.rotation;
            animator.SetTrigger("dieTrigger");
        }
    }