public override TaskStatus OnUpdate()
    {
        if (Vector3.Distance(transform.position, target.Value.position) <= checkDistance)
        {
            return(TaskStatus.Failure);
        }

        switch (thisGameObjName.Value)
        {
        case "CloseAttackEnemy01":
            closeAttackEnemyAni = GetComponent <CloseAttackTypeNormalAni>();
            closeAttackEnemyAni.aniSet("Rest");
            break;

        case "DistanceAttackEnemy01":
            distanceAttackAni = GetComponent <DistanceAttackTypeNormalAni>();
            distanceAttackAni.aniSet("Rest");
            break;

        case "Boss_01(Clone)":
            bossAni = GetComponent <BossAniScript>();
            break;
        }

        return(TaskStatus.Success);
    }
    public override TaskStatus OnUpdate()
    {
        if (waitForAttack.Value == false ||
            hpPostionScript.deadOrLive == 1 ||
            numOfPattern.Value != 2 ||
            colliderConScript.IsAttackedState == CloseAttackTypeNormalColliderCon.CloseAttackEnemy01IsAttacked.attacked)
        {
            return(TaskStatus.Failure);
        }


        if (aniScript.enemyPattern != CloseAttackEnemyType01AtkPattern.patternFar)
        {
            patternStart();
        }

        resetNowStateToStopFollowing(enemyPatternFarDistance, enemyAttackSpeedPatternFar);

        if (aniScript.enemyPattern == CloseAttackEnemyType01AtkPattern.patternFar &&
            Vector3.Distance(transform.position, target.Value.position) <= enemyPatternFarDistance)
        {
            aniScript.aniSet("patternFar02");
        }


        if (startTime + endTime < Time.time)
        {
            aniScript.aniSet("Reset_Ani");
            return(TaskStatus.Failure);
        }
        if (hpPostionScript.deadOrLive != 1)
        {
            rotate();
        }
        return(TaskStatus.Running);
    }
    private void OnTriggerExit(Collider other)
    {
        if (IsAttackedState == CloseAttackEnemy01IsAttacked.attacked)
        {
            return;
        }
        switch (other.gameObject.tag)
        {
        case "PlayerSword01":
            hpPostionScript.enemyDamagedAndImageChange(0.2f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;

        case "PlayerSword02":
            hpPostionScript.enemyDamagedAndImageChange(0.5f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                Invoke("hitObjOnOff", 1f);

                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;

        case "PlayerSword03":
            hpPostionScript.enemyDamagedAndImageChange(0.8f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                Invoke("hitObjOnOff", 1f);

                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;
        }

        if ((IsAttackedState == CloseAttackEnemy01IsAttacked.stuned) ||
            (PlayerInputScript.Instance.state != PlayerState.parring) ||
            (isAttack == false))
        {
            return;
        }

        switch (other.gameObject.name)
        {
        case "Player_Weapon_Shield":
            hpPostionScript.enemyDamagedAndImageChange(0.2f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            weaponColConScript.weaponColliderOff(0);

            parringObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                stunParicle.Play();
                isStun = true;

                aniScript.aniSet("Stuned");
                IsAttackedState = CloseAttackEnemy01IsAttacked.stuned;
                Invoke("parringObjOnOff", 3f);
                Invoke("stateChange", 1.5f);
            }
            break;
        }
    }
    public override void OnStart()
    {
        velo = Vector3.zero;

        startTime  = Time.time;
        randomTime = Random.Range(minRandomTime, maxRandomTime);

        switch (thisGameObjName.Value)
        {
        case "CloseAttackEnemy01":
            hpPostionScript = GetComponent <EnemyHpPostionScript>();
            closeAttackTypeNormalColliderCon = GetComponent <CloseAttackTypeNormalColliderCon>();
            closeAttackEnemyaniScript        = GetComponent <CloseAttackTypeNormalAni>();
            closeAttackEnemyaniScript.aniSet("Reset_Ani");
            break;

        case "DistanceAttackEnemy01":
            distanceAttackEnemyaniScript = GetComponent <DistanceAttackTypeNormalAni>();
            distanceAttackEnemyaniScript.aniSet("Reset_Ani");
            break;

        case "Boss_01(Clone)":
            boss01ColliderCon       = GetComponent <Boss01ColliderCon>();
            bossAniScript01         = GetComponent <BossAniScript>();
            weaponColliderConScript = GetComponent <WeaponColliderCon>();

            weaponColliderConScript.weaponColliderOff();

            for (int i = 1; i < 10; i++)
            {
                float num = 0;
                switch (i)
                {
                case 1:
                    num = 8f;
                    break;

                case 2:
                    num = 3f;
                    break;

                case 3:
                    num = 2f;
                    break;

                case 4:
                    num = 2f;
                    break;

                case 5:
                    num = 2f;
                    break;

                case 6:
                    num = 2f;
                    break;

                case 7:
                    num = 1.5f;
                    break;

                case 8:
                    num = 1.6f;
                    break;

                case 9:
                    num = 2f;
                    break;
                }

                bossAttackDistancePattern[i] = num;
            }
            break;
        }
    }
    public override TaskStatus OnUpdate()
    {
        switch (thisGameObjName.Value)
        {
        case "CloseAttackEnemy01":
            if ((hpPostionScript.deadOrLive != 1) ||
                (closeAttackTypeNormalColliderCon.IsAttackedState != CloseAttackTypeNormalColliderCon.CloseAttackEnemy01IsAttacked.stuned))
            {
                rotate();
            }

            if (startTime + randomTime < Time.time)
            {
                waitForAttack.Value = true;
                closeAttackEnemyaniScript.resetAni();
                return(TaskStatus.Success);
            }
            if (Vector3.Distance(transform.position, target.Value.position) >= 4f)
            {
                closeAttackEnemyaniScript.aniSet("Run");
                transform.position = Vector3.SmoothDamp(transform.position, target.Value.position, ref velo, 5f);
            }
            else
            {
                closeAttackEnemyaniScript.forIdle();
            }
            break;

        case "DistanceAttackEnemy01":
            if (startTime + randomTime < Time.time)
            {
                distanceAttackEnemyaniScript.aniSet("Reset_Ani");
                waitForAttack.Value = true;
                return(TaskStatus.Success);
            }
            if (Vector3.Distance(transform.position, target.Value.position) >= 8f)
            {
                distanceAttackEnemyaniScript.aniSet("Run");
                transform.position = Vector3.SmoothDamp(transform.position, target.Value.position, ref velo, 5f);
            }
            else
            {
                distanceAttackEnemyaniScript.aniSet("Reset_Ani");
                waitForAttack.Value = true;
            }
            break;

        case "Boss_01(Clone)":
            if (startTime + randomTime < Time.time)
            {
                bossAniScript01.resetAttackPattern();
                waitForAttack.Value = true;

                if (Vector3.Distance(transform.position, target.Value.position) < 7f)
                {
                    ifClosePatternChoiceBoss01();
                }
                else
                {
                    ifFarPatternChoiceBoss01();
                }

                switch (numOfPattern.Value)
                {
                case 2:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern02;
                    break;

                case 3:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern03;
                    break;

                case 4:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern04;
                    break;

                case 5:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern05;
                    break;

                case 6:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern06;
                    break;

                case 7:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern07;
                    break;

                case 8:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern08;
                    break;

                case 9:
                    bossAniScript01.bossPatternStorageToCheckLastOneState = BossPatternStorageToCheckLastOne.pattern09;
                    break;
                }

                return(TaskStatus.Success);
            }
            if (Vector3.Distance(transform.position, target.Value.position) >= 5f)
            {
                bossAniScript01.run();
                transform.position = Vector3.SmoothDamp(transform.position, target.Value.position, ref velo, 5f);
            }
            else
            {
                bossAniScript01.resetAttackPattern();
            }
            break;
        }

        rotate();
        return(TaskStatus.Running);
    }