Ejemplo n.º 1
0
    public override void OnUpdate(AutoPilot ap)
    {
        /*
         * if(Counter == 0f){
         *      armoriserHUD.StartHUD(ap);
         * }else{
         *      armoriserHUD.StartUpHUD(ap, Counter);
         * }
         * Counter += 2f;
         * if(Counter > 361f){
         *      armoriserHUD.ContinueRend(ap);
         * }
         * armoriserHUD.SearchObject(ap);
         */

        /*
         * ap.Print(0,ap.GetFlightTime());
         * ap.Print(1,ap.GetVelocity().y);
         * ap.Print(2,Mathf.Floor(ap.GetSpeed()) * 3800 / 1000);
         * ap.Print(3,Counter);
         */

        //データロード
        if (Input.GetKey(KeyCode.F7) && Input.GetKey(KeyCode.LeftAlt))
        {
            if (PushedTab == false)
            {
                ReadAssignFile(ap);
                PushedTab = true;
            }
        }
        else
        {
            PushedTab = false;
        }



        if (Input.GetKey(AimAssist))
        {
            if (IsPushedAlpha2 == false && isAiming == false)
            {
                isAiming       = true;
                IsPushedAlpha2 = true;
            }
            else if (IsPushedAlpha2 == false && isAiming == true)
            {
                isAiming       = false;
                IsPushedAlpha2 = true;
            }
        }
        else
        {
            IsPushedAlpha2 = false;
        }
        if (Input.GetKey(BoostKey))
        {
            if (IsPushedF == false)
            {
                if (IsboostMode == false)
                {
                    IsboostMode = true;
                }
                else if (IsboostMode == true)
                {
                    IsboostMode = false;
                }
                IsPushedF = true;
            }
        }
        else
        {
            IsPushedF = false;
        }
        if (Input.GetKey(ChangeOptKey))
        {
            if (IsPushedKeyPad5 == false)
            {
                if (RancherMode == false)
                {
                    RancherMode = true;
                }
                else if (RancherMode == true)
                {
                    RancherMode = false;
                }
                if (AimingOpt == false)
                {
                    AimingOpt = true;
                }
                else if (AimingOpt == true)
                {
                    AimingOpt = false;
                }
                IsPushedKeyPad5 = true;
            }
        }
        else
        {
            IsPushedKeyPad5 = false;
        }
        if (Input.GetKey(AimKey))
        {
            if (IsPushedT == false)
            {
                if (Aiming == false)
                {
                    Aiming = true;
                }
                else if (Aiming == true)
                {
                    Aiming = false;
                }
                IsPushedT = true;
            }
        }
        else
        {
            IsPushedT = false;
        }
        if (Input.GetKey(LauncherKey))
        {
            if (IsPushedKeypad4 == false)
            {
                if (IsSGMode == false)
                {
                    IsSGMode = true;
                }
                else if (IsSGMode == true)
                {
                    IsSGMode = false;
                }
                IsPushedKeypad4 = true;
            }
        }
        else
        {
            IsPushedKeypad4 = false;
        }


        if (AimingOpt == false)
        {
            if (Input.GetKey(Wep1))
            {
                if (IsSGMode == false)
                {
                    ap.StartAction("Main", 1);
                }
                else if (IsSGMode == true)
                {
                    ap.StartAction("SG", 1);
                }
            }
            if (Input.GetKey(Wep2) && Input.GetKey(Wep3))
            {
                ap.StartAction("Sub2", 1);
            }
            else
            {
                if (Input.GetKey(Wep2))
                {
                    ap.StartAction("Sword", 1);
                }
                if (Input.GetKey(Wep3))
                {
                    ap.StartAction("Sub", 1);
                }
            }
        }
        else
        {
            if (Input.GetKey(Wep1))
            {
                if (IsSGMode == false)
                {
                    ap.StartAction("OptWepF1", 2);
                }
                else
                {
                    ap.StartAction("OptWepF5", 2);
                }
            }
            if (Input.GetKey(Wep2) && Input.GetKey(Wep3))
            {
                ap.StartAction("OptWepF4", 2);
            }
            else
            {
                if (Input.GetKey(Wep2))
                {
                    ap.StartAction("OptWepF2", 2);
                }
                if (Input.GetKey(Wep3))
                {
                    ap.StartAction("OptWepF3", 2);
                }
            }
        }


        if (ChangeAim == true)
        {
            if (Aiming == true && AimingOpt == false)
            {
                if (isChengedAiming == false)
                {
                    ap.StartAction("Aim", -1);
                    ap.EndAction("OptWep");
                    isChengedAiming    = true;
                    isChengedAimingOpt = false;
                }
            }
            else if (Aiming == true && AimingOpt == true)
            {
                if (isChengedAimingOpt == false)
                {
                    ap.StartAction("OptWep", -1);
                    ap.EndAction("Aim");
                    isChengedAiming    = false;
                    isChengedAimingOpt = true;
                }
            }
            else
            {
                ap.EndAction("OptWep");
                ap.EndAction("Aim");
                isChengedAiming    = false;
                isChengedAimingOpt = false;
            }
        }
        else
        {
            if (Aiming == true && AimingOpt == false)
            {
                if (isChengedAiming == false)
                {
                    ap.StartAction("Aim", -1);
                    ap.EndAction("OptWep");
                    isChengedAiming    = true;
                    isChengedAimingOpt = false;
                }
            }
            else if (Aiming == true && AimingOpt == true)
            {
                if (isChengedAimingOpt == false)
                {
                    ap.StartAction("OptWep", -1);
                    isChengedAiming    = false;
                    isChengedAimingOpt = true;
                }
            }
            else
            {
                ap.EndAction("OptWep");
                ap.EndAction("Aim");
                isChengedAiming    = false;
                isChengedAimingOpt = false;
            }
        }

        if (RancherMode == true)
        {
            if (Input.GetKey(Missile))
            {
                ap.StartAction("Launcher", 1);
            }
        }
        else
        {
            if (Input.GetKey(Missile))
            {
                ap.StartAction("Missile2", 1);
            }
        }


        if (ap.GetFlightTime() <= 0.5f)
        {
            if (Input.GetKey(MoveF) || Input.GetKey(MoveB) || Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
            {
                ap.StartAction("AnyAssig", 1);
            }

            if (Input.GetKey(MoveB) == false)
            {
                if (Input.GetKey(MoveF) == false)
                {
                    if (Input.GetKey(MoveL))
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveL", 1);
                        ap.StartAction("WalkF", 1);
                    }
                    if (Input.GetKey(KeyCode.E))
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveR", 1);
                        ap.StartAction("WalkF", 1);
                    }
                }
                else
                {
                    if (Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
                    {
                        if (Input.GetKey(MoveL))
                        {
                            ap.StartAction("ThrustF", 1);
                            ap.StartAction("MoveF", 1);
                            ap.StartAction("MoveL", 1);
                            ap.StartAction("WalkF", 1);
                        }
                        if (Input.GetKey(KeyCode.E))
                        {
                            ap.StartAction("ThrustF", 1);
                            ap.StartAction("MoveF", 1);
                            ap.StartAction("MoveR", 1);
                            ap.StartAction("WalkF", 1);
                        }
                    }
                    else
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveF", 1);
                        ap.StartAction("WalkF", 1);
                    }
                }
            }
            else
            {
                if (Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
                {
                    if (Input.GetKey(MoveL))
                    {
                        ap.StartAction("ThrustB", 1);
                        ap.StartAction("MoveR", 1);
                        ap.StartAction("MoveB", 1);
                        ap.StartAction("WalkF", 1);
                    }
                    if (Input.GetKey(KeyCode.E))
                    {
                        ap.StartAction("ThrustB", 1);
                        ap.StartAction("MoveL", 1);
                        ap.StartAction("MoveB", 1);
                        ap.StartAction("WalkF", 1);
                    }
                }
                else
                {
                    ap.StartAction("ThrustB", 1);
                    ap.StartAction("MoveB", 1);
                    ap.StartAction("WalkF", 1);
                }
            }

            if (IsboostMode == true)
            {
                ap.EndAction("ThrustF");
                ap.EndAction("ThrustB");
                if (Input.GetKey(MoveF))
                {
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveF");
                }
                if (Input.GetKey(MoveB))
                {
                    ap.StartAction("SlideB", 1);
                    ap.EndAction("MoveB");
                }
                if (Input.GetKey(MoveL))
                {
                    ap.StartAction("SlideF", 20);
                    ap.StartAction("MoveL", 1);
                }
                if (Input.GetKey(KeyCode.E))
                {
                    ap.StartAction("SlideF", 20);
                    ap.StartAction("MoveR", 1);
                }
                if (Input.GetKey(MoveU))
                {
                    ap.StartAction("SlideU", 1);
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveU");
                }
                else if (ap.GetVelocity().y < 0)
                {
                    ap.StartAction("SlideU", 1);
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveU");
                }
                if (Input.GetKey(MoveD))
                {
                    //ap.StartAction("SlideD", 1);
                    //ap.EndAction("MoveD");
                }
            }
            else
            {
                if (ap.CheckAction("ThrustF"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                }
                else if (ap.CheckAction("ThrustB"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustB", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustB", 1);
                    }
                }
                else
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                }
            }
        }
        else
        {
            if (ap.GetGroundClearance() > 3)
            {
                ap.StartAction("FryMode", 1);
            }

            if (Input.GetKey(MoveF) || Input.GetKey(MoveB) || Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
            {
                ap.StartAction("AnyAssig", 1);
            }

            if (Input.GetKey(MoveB) == false)
            {
                if (Input.GetKey(MoveF) == false)
                {
                    if (Input.GetKey(MoveL))
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveUL", 1);
                    }
                    if (Input.GetKey(KeyCode.E))
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveUR", 1);
                    }
                }
                else
                {
                    if (Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
                    {
                        if (Input.GetKey(MoveL))
                        {
                            ap.StartAction("ThrustF", 1);
                            ap.StartAction("MoveUF", 1);
                            ap.StartAction("MoveUL", 1);
                        }
                        if (Input.GetKey(KeyCode.E))
                        {
                            ap.StartAction("ThrustF", 1);
                            ap.StartAction("MoveUF", 1);
                            ap.StartAction("MoveUR", 1);
                        }
                    }
                    else
                    {
                        ap.StartAction("ThrustF", 1);
                        ap.StartAction("MoveUF", 1);
                    }
                }
            }
            else
            {
                if (Input.GetKey(MoveL) || Input.GetKey(KeyCode.E))
                {
                    if (Input.GetKey(MoveL))
                    {
                        ap.StartAction("ThrustB", 1);
                        ap.StartAction("MoveULB", 1);
                        ap.StartAction("MoveUB", 1);
                    }
                    if (Input.GetKey(KeyCode.E))
                    {
                        ap.StartAction("ThrustB", 1);
                        ap.StartAction("MoveURB", 1);
                        ap.StartAction("MoveUB", 1);
                    }
                }
                else
                {
                    ap.StartAction("ThrustB", 1);
                    ap.StartAction("MoveUB", 1);
                }
            }



            if (IsboostMode == true)
            {
                ap.EndAction("ThrustF");
                ap.EndAction("ThrustB");
                if (Input.GetKey(MoveF))
                {
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveUF");
                }
                if (Input.GetKey(MoveB))
                {
                    ap.StartAction("SlideB", 1);
                    ap.EndAction("MoveB");
                }
                if (Input.GetKey(MoveL))
                {
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveL");
                }
                if (Input.GetKey(KeyCode.E))
                {
                    ap.StartAction("SlideF", 20);
                    ap.EndAction("MoveR");
                }
                if (ap.CheckAction("SlideF"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("SlideF", 20);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("SlideF", 20);
                    }
                }
                else if (ap.CheckAction("SlideB"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("SlideB", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("SlideB", 1);
                    }
                }
                else
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("SlideF", 20);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("SlideF", 20);
                    }
                }
            }
            else
            {
                if (ap.CheckAction("ThrustF"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                }
                else if (ap.CheckAction("ThrustB"))
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustB", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustB", 1);
                    }
                }
                else
                {
                    if (Input.GetKey(MoveU))
                    {
                        ap.StartAction("MoveU", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                    else if (Input.GetKey(MoveD))
                    {
                        ap.StartAction("MoveD", 1);
                        ap.StartAction("ThrustF", 1);
                    }
                }
            }
        }


        if (isAiming)
        {
            SavedVelocity  = new Vector3(Mathf.Lerp(SavedVelocity.x, ap.GetVelocity().normalized.x, 0.5f), Mathf.Lerp(SavedVelocity.y, ap.GetVelocity().normalized.y, 0.5f), Mathf.Lerp(SavedVelocity.z, ap.GetVelocity().normalized.z, 0.5f));
            ray            = new Ray(ap.AddVec(ap.GetPosition(), ap.MulVec(ap.GetCameraForward(), 10f)), ap.AddVec(ap.GetCameraForward(), ap.MulVec(SavedVelocity, 0.1f)));
            targetPosition = ray.GetPoint(1000f);
            ap.DrawLine3D(Color.yellow, ray.origin, targetPosition);
            if (Physics.Raycast(ray.origin, ray.direction, out hit, 1000f))
            {
                ap.Print(4, hit.transform.name);
                if (ap.MeasureClearance((int)(ap.AddVec(ap.GetCameraForward(), ap.MulVec(SavedVelocity, 0.05f)).x * 1000), (int)(ap.AddVec(ap.GetCameraForward(), ap.MulVec(SavedVelocity, 0.05f)).y * 1000), (int)(ap.AddVec(ap.GetCameraForward(), ap.MulVec(SavedVelocity, 0.05f)).z * 1000), (int)hit.distance + 50) != 9999)
                {
                    ap.DrawLine3D(Color.red, ap.GetPosition(), targetPosition);
                }
                else
                {
                    ap.DrawLine3D(Color.green, ap.GetPosition(), targetPosition);
                }
            }
            else
            {
                ap.DrawLine3D(Color.red, ap.GetPosition(), targetPosition);
            }
        }

        Vector2 MachineForward       = new Vector2(ap.GetForward().x, ap.GetForward().z);
        Vector2 CameraForward        = new Vector2(ap.GetCameraForward().x, ap.GetCameraForward().z);
        float   DotVariable          = Vector2.Dot(MachineForward.normalized, CameraForward.normalized);
        int     CalcAngleRWithCamera = ap.CalcAngleR(ap.GetCameraPosition());

        ap.Log(DotVariable);
        if (DotVariable < 0.6f)
        {
            if (CalcAngleRWithCamera < 0)
            {
                ap.StartAction("TurnR", 1);
            }
            else
            {
                ap.StartAction("TurnL", 1);
            }
        }
        else if (DotVariable < 0.8f)
        {
            if (CalcAngleRWithCamera < 0)
            {
                ap.StartAction("TurnR2", 1);
            }
            else
            {
                ap.StartAction("TurnL2", 1);
            }
        }
        else if (DotVariable < 0.98f)
        {
            if (CalcAngleRWithCamera < 0)
            {
                ap.StartAction("TurnR3", 1);
            }
            else
            {
                ap.StartAction("TurnL3", 1);
            }
        }

        /*
         * int DotVariable = ap.CalcAngleR(ap.GetCameraPosition());
         * ap.Log(DotVariable);
         * if(DotVariable > -90 && DotVariable < 90){
         *      if(ap.CalcAngleR(ap.GetCameraPosition()) < 0){
         *              ap.StartAction("TurnR", 2);
         *      }else{
         *              ap.StartAction("TurnL", 2);
         *      }
         * }else if(DotVariable > -170 && DotVariable < 170){
         *      if(ap.CalcAngleR(ap.GetCameraPosition()) < 0){
         *              ap.StartAction("TurnR2", 2);
         *      }else{
         *              ap.StartAction("TurnL2", 2);
         *      }
         * }else if(DotVariable > -175 && DotVariable < 175){
         *      if(ap.CalcAngleR(ap.GetCameraPosition()) < 0){
         *              ap.StartAction("TurnR3", 2);
         *      }else{
         *              ap.StartAction("TurnL3", 2);
         *      }
         * }
         */
    }
Ejemplo n.º 2
0
    //----------------------------------------------------------------------------------------------
    // 更新処理
    //----------------------------------------------------------------------------------------------
    public override void OnUpdate(AutoPilot ap)
    {
        // 待機
        if (wait > 0)
        {
            --wait;
            ap.Log("wait=" + wait);
            return;
        }

        // 自爆演出(右回転+上昇→自爆)
        if (suicideWait > 0)
        {
            ap.TurnMover(ap.GetPosition() + ap.GetRight());
            ap.SetMoverAltitude(100);
            if (--suicideWait == 0)
            {
                ap.Suicide();
            }
            return;
        }

        // 索敵(ヘルスが満タンでなかったら前方優先で近い敵を選択,攻撃を検出したら捕捉対象を変更)
        if (!ap.CheckEnemy() && ap.GetHealth() < 100)
        {
            ap.SearchEnemy();
        }
        if (count % 600 == 0)
        {
            ap.SetCounterSearch(500);
        }

        float   enemyDistance = ap.GetEnemyDistance();
        float   enemyAngleR   = ap.GetEnemyAngleR();
        float   enemyAngleU   = ap.GetEnemyAngleU();
        Vector3 enemyVelocity = ap.GetEnemyVelocity();

        // 情報表示
        ap.Print(0, "Enemy : " + ap.GetEnemyName());
        ap.Print(1, "Distance : " + enemyDistance);
        ap.Print(2, "AngleR : " + enemyAngleR);
        ap.Print(3, "AngleU : " + enemyAngleU);
        ap.Print(4, "Speed(m/s) : " + Mathf.RoundToInt(Vector3.Magnitude(enemyVelocity)));
        if (Time.frameCount % 60 == 0)
        {
            ap.Print(8, "Random : " + Random.Range(0, 99));
        }

        if (ap.CheckEnemy())
        {
            var relVel = ap.GetEnemyVelocity() - ap.GetVelocity(); // 相対速度
            var estPos = ap.GetEnemyPosition() + relVel * 0.2f;    // 着弾予測座標
            ap.TurnMover(estPos);                                  // 旋回(Mover専用)
            ap.Aim(estPos);                                        // エイム
        }

        // 武器選択&通知
        var prevAttackAction = attackAction;
        int attackAngle      = 10;
        int attackEnergy     = 50;

        if (enemyDistance < 20)
        {
            attackAction = "Sword";
            attackAngle  = 60;
            attackEnergy = 20;
        }
        else if (chargeCount > 0)
        {
            attackAction = "Beamer";
        }
        else if (enemyDistance > 40 && enemyDistance < 250)
        {
            attackAction = "Cannon";
        }
        else if (enemyDistance > 300)
        {
            attackAction = "Beamer";
        }

        // 武器破損チェック(代替武器に変更,代替武器も破損していたら自爆開始)
        if (ap.GetSurvivalRate(attackAction) < 50)
        {
            attackAction = attackAction == "Cannon" ? "Beamer" : "Cannon";
        }
        if (ap.GetSurvivalRate(attackAction) < 50)
        {
            suicideWait = 180;
        }

        // 武器変更通知(ログ出力)
        bool isWeaponChanged = attackAction != prevAttackAction;

        if (isWeaponChanged)
        {
            ap.Log(attackAction + " is selected.");
        }

        // 攻撃中止
        int energy = ap.GetEnergy();

        if (Mathf.Abs(enemyAngleR) > attackAngle * 2 || energy < 10 || isWeaponChanged || !ap.CheckEnemy())
        {
            ap.EndAction("Sword");
            ap.EndAction("Cannon");
            ap.EndAction("Beamer");
        }

        // 攻撃開始(ダメージを受けた後ENに余裕があったら選択中の武器で攻撃,下方に敵がいたらグレネード)
        if (ap.GetHealth() < 100 && ap.CheckEnemy())
        {
            if (enemyAngleU < -70)
            {
                ap.StartAction("Grenade", 1);
            }
            else if (Mathf.Abs(enemyAngleR) < attackAngle && energy > attackEnergy)
            {
                ap.StartAction(attackAction, -1);
            }
        }

        // ランチャーチャージ開始(ダメージを受けた後ENに余裕があったら実行)
        if (chargeCount == 0 && energy > 60 && ap.GetHealth() < 100 && ap.CheckEnemy())
        {
            ap.StartAction("Launcher", -1);
        }

        // ランチャー発射(一定時間チャージした後ロックオン中またはEN切れなら実行)
        if (ap.CheckAction("Launcher"))
        {
            ++chargeCount;
            if (chargeCount > 200)
            {
                if (ap.CheckLockOn() || energy < 5 || chargeCount > 800)
                {
                    ap.EndAction("Launcher");
                    chargeCount = 0;
                }
            }
        }

        // 水平移動(脅威を回避してターゲットとの距離を保つ,至近距離なら近づく,暇なら開始座標に戻る)
        ap.SearchThreat(MASK_ALL, 100);
        if (ap.CheckThreat())
        {
            ap.StartAction(ap.GetThreatAngleR() < 0 ? "HoverR" : "HoverL", 10);
        }
        else if (ap.CheckEnemy())
        {
            if (energy < 30)
            {
                ap.StartAction("HoverB", 10);
            }
            else if (Mathf.Abs(enemyAngleR) < 45)
            {
                if (enemyDistance > 10 && enemyDistance < 50)
                {
                    ap.StartAction("HoverF", 10);
                }
                else if (enemyDistance < 100)
                {
                    ap.StartAction("HoverB", 10);
                }
                else if (enemyDistance > 500)
                {
                    ap.StartAction("HoverF", 10);
                }
            }
        }
        else if (Vector3.Distance(ap.GetPosition(), startPosition) > 50)
        {
            ap.TurnMover(startPosition);
            ap.SetMoverAltitude(10);
            ap.StartAction("HoverF", 10);
        }

        // 垂直移動(敵を少し見上げる)
        if (chargeCount > 0)
        {
            ap.SetMoverAltitude(100);
        }
        else if (ap.CheckEnemy())
        {
            if (enemyAngleU < 5)
            {
                ap.StartAction("HoverD", 10);
            }
            else if (enemyAngleU > 15)
            {
                ap.StartAction("HoverU", 10);
            }
        }

        // 転覆から復帰
        if (ap.GetTilt() > 60)
        {
            ap.Recover();
        }

        ++count;
    }