protected override void AISelectDisturb_aiOrg()
    {
        base.AISelectDisturb_aiOrg();

        if (Mathf.Abs(EnemyCtrl_fly.GetDistanceGround() - flyHight) > 1.0f)
        {
            heightModify = true;
        }
        if (swichFlyMode)//飛行遷移処理
        {
            AIOrgSetNowAction("fly_swich");
        }
        else if (flyMode)//飛行処理
        {
            if (heightModify)
            {
                AIOrgSetNowAction("fly_modify");
            }
            else
            {
                AIOrgSetNowAction("fly");
            }
        }
        else//地上処理
        {
            AIOrgSetNowAction("default");
        }
    }
 void AIUpdate_modifiHeight()
 {
     if (EnemyCtrl_fly.MoveToTarget_Y(flyHight, MoveSpeedY))
     {
         SetAIState(AISTATE.AISELECT, 3.0f);
         heightModify = false;
     }
 }
    protected override void AIUpdate_fly_detect()
    {
        base.AIUpdate_fly_detect();
        float rand = GetAIRandomNumver();

        switch (aiState)
        {
        case AISTATE.AISELECT:
            if (rand < AddAIProbNum(aiStateFly_flyEnd * ChengeModeRate))
            {
                FlyMode_end();
            }
            else if (rand < AddAIProbNum(aiStateFly_approch))
            {
                SetAIState(AISTATE.APPROACH_DASH, 5.0f);
            }
            else if (rand < AddAIProbNum(aiStateFly_escape))
            {
                SetAIState(AISTATE.ESCAPE_DASH, 3.0f);
            }
            else if (rand < AddAIProbNum(aiStateFly_attack))
            {
                SetAIState(AISTATE.ATTACK, 20.0f);
            }

            break;

        case AISTATE.APPROACH_DASH:
            if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed))
            {
                SetAIState(AISTATE.ATTACK, 20.0f);
            }
            break;

        case AISTATE.ESCAPE_DASH:
            if (nowTargetPos == null)
            {
                if (EnemyCtrl_fly.GetDistancePlayer_X() > 40.0f)
                {
                    SetAIState(AISTATE.APPROACH_DASH, 5.0f);
                    return;
                }
                EnemyCtrl_fly.SetDirectionToPl();
                nowTargetPos = EnemyCtrl_fly.GetPostionFromPl_NearMe(40.0f);
            }
            if (EnemyCtrl_fly.MoveToTarget_X_reverse(1.0f, (Vector2)nowTargetPos, moveSpeed * 0.8f))
            {
                nowTargetPos = null;
                SetAIState(AISTATE.ATTACK, 20.0f);
            }
            break;

        case AISTATE.WAIT:
            break;
        }
    }
 /// <summary>
 /// swichFlyModeの終了処理
 /// FlyModeの変更時に呼ばれる
 /// </summary>
 void StartSwichFlyMode()
 {
     swichFlyMode = true;
     SetAIState(AISTATE.WAIT, 3.0f);//swichFlyのAI関数に入るための処理
     AISelectDisturb_aiOrg();
     EnemyCtrl_fly.StopMove();
     nowModeActionCount = 0;
     if (flyMode)//上昇時は最初にanimationを呼ぶ
     {
         StartFlyAnimation();
     }
 }
    protected override void AIUpdate_detect()
    {
        base.AIUpdate_detect();
        float rand = GetAIRandomNumver();

        switch (aiState)
        {
        case AISTATE.AISELECT:
            if (rand < AddAIProbNum(aiStateNum_fly * ChengeModeRate))
            {
                FlyMode_start();
            }
            else if (rand < AddAIProbNum(aiStateNum_walk))
            {
                SetAIState(AISTATE.APPROACH_WALK, 4.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_dash))
            {
                SetAIState(AISTATE.APPROACH_DASH, 4.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_attack))
            {
                SetAIState(AISTATE.ATTACK, 20.0f);
            }
            else if (rand < 100)
            {
                SetAIState(AISTATE.WAIT, 4.0f);
                animator.SetTrigger("rest");
            }
            break;

        case AISTATE.APPROACH_WALK:
            if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed * 0.5f))
            {
                SetAIState(AISTATE.ATTACK, 20.0f);
            }
            break;

        case AISTATE.APPROACH_DASH:
            if (EnemyCtrl_fly.MoveToPlayer_X(10.0f, moveSpeed))
            {
                SetAIState(AISTATE.ATTACK, 20.0f);
            }
            break;

        case AISTATE.ATTACK:
            break;

        case AISTATE.WAIT:
            break;
        }
    }
 /// <summary>
 /// flyAnimationの終了処理 
 /// animationから呼ぶ
 /// </summary>
 public void EndFlyAnimation()
 {
     StartCoroutine(EnemyCtrl.WaitFrameAction(1, () => SetAIStop(false)));
     EnemyCtrl.AnimEvent_ReplaceBodyPosition();
     if (flyMode)
     {
         EnemyCtrl_fly.GravityOff();
     }
     else//下降時時はここで飛行処理終了
     {
         SetAIState(AISTATE.AISELECT, 3.0f);
         EnemyCtrl_fly.GravityOn();
     }
 }
 /// <summary>
 /// swichFlyModeの終了処理
 /// AIで条件を判定して呼ぶ
 /// </summary>
 protected void EndSwichFlyMode()
 {
     swichFlyMode = false;
     EnemyCtrl_fly.StopMove();
     EnemyCtrl_fly.StopMove_Y();
     if (flyMode)//上昇時はここで飛行処理終了
     {
         SetAIState(AISTATE.AISELECT, 3.0f);
     }
     else//下降時は最後にanimationを呼ぶ
     {
         StartFlyAnimation();
     }
 }
    protected override void AIUpdate_undetect()
    {
        base.AIUpdate_undetect();
        float rand = GetAIRandomNumver();

        switch (aiState)
        {
        case AISTATE.AISELECT:
            if (rand < AddAIProbNum(aiStateNum_ud_walk))
            {
                SetAIState(AISTATE.APPROACH_WALK, 4.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_ud_wait))
            {
                SetAIState(AISTATE.WAIT, 4.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_ud_rest))
            {
                SetAIState(AISTATE.ATTACK, 5.0f);
            }
            break;

        case AISTATE.WAIT:
            break;

        case AISTATE.APPROACH_WALK:
            if (nowTargetPos == null)
            {
                rand         = GetAIRandomNumver();
                nowTargetPos = (Vector2)transform.position + new Vector2((rand > 50) ? 20 : -20, 0);
            }
            if (EnemyCtrl_fly.MoveToTarget_X(3.0f, (Vector2)nowTargetPos, moveSpeed))
            {
                SetAIState(AISTATE.WAIT, 2.0f);
                nowTargetPos = null;
            }
            break;

        case AISTATE.ATTACK:
            animator.SetTrigger("rest");
            SetAIState(AISTATE.WAIT, 5.0f);
            break;
        }
    }
 protected override void AIUpdate_swichFly()
 {
     base.AIUpdate_swichFly();
     if (FlyMode)
     {
         //if (EnemyCtrl_fly.MoveToHigher(FlyHight, MoveSpeedY))
         if (EnemyCtrl_fly.MoveToTarget_Y(FlyHight, MoveSpeedY))
         {
             EndSwichFlyMode();
         }
     }
     else
     {
         if (EnemyCtrl_fly.MoveToLower(FlyHight_land, MoveSpeedY))
         {
             EndSwichFlyMode();
         }
     }
 }
    protected override void AIUpdate_fly_attack()
    {
        base.AIUpdate_fly_attack();
        float rand = GetAIRandomNumver();

        if (rand < AddAIProbNum(aiStateFlyAt_dive))
        {
            EnemyCtrl_fly.SetDirectionToPl();
            animator.SetTrigger("At_dive");
            StartAttack();
        }
        else if (rand < AddAIProbNum(aiStateFlyAt_fire))
        {
            if (EnemyCtrl_fly.GetDistancePlayer_X() < 10.0f)
            {
                return;
            }
            EnemyCtrl_fly.SetDirectionToPl();
            animator.SetTrigger("At_fire_sky");
            StartAttack();
        }
    }
    protected override void AIUpdate_attack()
    {
        base.AIUpdate_attack();
        float rand = GetAIRandomNumver();

        if (rand < AddAIProbNum(aiStateFrontPl_dash))
        {
            EnemyCtrl_fly.SetDirectionToPl();
            animator.SetTrigger("At_dash");
            StartAttack();
        }
        else if (rand < AddAIProbNum(aiStateFrontPl_head))
        {
            if (EnemyCtrl_fly.IsPlayerFront())
            {
                animator.SetTrigger("At_head");
                StartAttack();
            }
        }
        else if (rand < AddAIProbNum(aiStateFrontPl_tail))
        {
            if (!EnemyCtrl_fly.IsPlayerFront())
            {
                animator.SetTrigger("At_tail");
                StartAttack();
            }
        }
        else if (rand < AddAIProbNum(aiStateFrontPl_fire))
        {
            if (EnemyCtrl_fly.IsPlayerFront())
            {
                animator.SetTrigger("At_fire");
                StartAttack();
            }
        }
    }
 protected override void AIUpdate_mapchengeFly()
 {
     base.AIUpdate_mapchengeFly();
     EnemyCtrl_fly.MoveToTarget_X(0.0f, mapChengeCtrl.GetNextLoadPosition(), EnemyCtrl_fly.MoveSpeed);
 }