Exemplo n.º 1
0
    private IEnumerator FarAttack(RaycastHit2D enemy)// 遠距離攻撃
    {
        EnemyControll enemyControll = enemy.collider.gameObject.GetComponent <EnemyControll>();

        while (FarRayHitJudge())
        {
            if (enemy.collider.gameObject.tag == enemyTagName)// 雑魚エネミーなら
            {
                enemyControll.EnemyHPMinus();
                if (enemyControll.EnemyHPReturn() <= 0)// 雑魚エネミーのHPが0になったら
                {
                    break;
                }
            }
            else if (enemy.collider.gameObject.tag == bossTagName)// ボスエネミーなら
            {
                enemyControll.EnemyBossHPMinus();
                if (enemyControll.EnemyBossHPReturn() <= 0)// ボスエネミーのHPが0になったら
                {
                    break;
                }
            }
        }
        yield break;
    }
Exemplo n.º 2
0
    private void NearAttack(RaycastHit2D enemy)// 近距離攻撃
    {
        if (jumpFlag)
        {
            animator.SetBool(jumpAttackAnimFlag, true);
            animator.SetBool(jumpAttackAnimFlag, false);
        }
        else
        {
            animator.SetBool(attackAnimFlag, true);// 攻撃アニメーション再生
            animator.SetBool(attackAnimFlag, false);
        }
        EnemyControll enemyControll = enemy.collider.gameObject.GetComponent <EnemyControll>();

        if (enemy.collider.gameObject.tag == enemyTagName)// 雑魚エネミーなら
        {
            enemyControll.EnemyHPMinus();
        }
        else if (enemy.collider.gameObject.tag == bossTagName)// ボスエネミーなら
        {
            enemyControll.EnemyBossHPMinus();
        }
    }