Beispiel #1
0
        public void NearUpdate(Player player)
        {
            //敵専用AIなので事前に変換しておく
            EnemyBase enemyActor = (EnemyBase)actor;

            #region 索敵範囲
            if (!Confuse())
            {
                if (enemyActor.SearchCheck(player))
                {
                    if (!(moveAi is MoveAi_Chase) && attackAi is AttackAi_Wait)
                    {
                        moveAi = new MoveAi_Chase(actor, player);
                    }
                }
                else
                {
                    if (moveAi is MoveAi_Search)
                    {
                        return;
                    }
                    moveAi = new MoveAi_Search(actor);
                }
            }
            #endregion

            #region 攻撃範囲
            if (enemyActor.AttackCheck(player))
            {
                if (attackAi is AttackAi_Wait)
                {
                    attackAi = new AttackAi_Charge(actor, enemyActor.GetStatus().Attackspd, 1, enemyActor.GetStatus().Attackspd);
                }
                if (moveAi is MoveAi_Chase && !Confuse())
                {
                    moveAi = new MoveAi_Wait(actor);
                }
                if (moveAi is MoveAi_Wait && attackAi is AttackAi_CoolDown && !Confuse())
                {
                    moveAi = new MoveAi_Escape(actor, player);
                }
            }
            else
            {
                if (moveAi is MoveAi_Escape && enemyActor.WaitPointCheck(player) && !Confuse())
                {
                    moveAi = new MoveAi_Wait(actor);
                }
            }
            #endregion
            if (Confuse() && !(moveAi is MoveAi_Search))
            {
                moveAi = new MoveAi_Search(actor);
            }
        }
        public void NearUpdate(Player player)
        {
            //敵専用AIなので事前に変換しておく
            EnemyBase enemyActor = (EnemyBase)actor;

            #region 索敵範囲

            if (enemyActor.SearchCheck(player))
            {
                if ((moveAi is MoveAi_Wait || moveAi is MoveAi_Escape) && attackAi is AttackAi_Wait)
                {
                    moveAi = new MoveAi_Chase(actor, player);
                }
            }
            else
            {
                if (moveAi is MoveAi_Search)
                {
                    return;
                }
                moveAi = new MoveAi_Search(actor);
            }
            #endregion

            #region 索敵範囲内攻撃範囲外

            if (enemyActor.SearchCheck(player) && !enemyActor.AttackCheck(player))
            {
                if (moveAi is MoveAi_Escape)
                {
                    moveAi = new MoveAi_Chase(actor, player);
                }
            }

            #endregion

            #region 攻撃範囲内退避範囲外

            if (enemyActor.AttackCheck(player) && !enemyActor.WaitPointCheck(player))
            {
                if (moveAi is MoveAi_Chase)
                {
                    moveAi = new MoveAi_Wait(actor);
                }

                if (attackAi is AttackAi_Wait)
                {
                    //時間は仮実装
                    attackAi = new AttackAi_Charge(actor, enemyActor.GetStatus().Attackspd, 1, enemyActor.GetStatus().Attackspd);
                }
            }
            #endregion

            #region 逃げる範囲
            if (enemyActor.WaitPointCheck(player))
            {
                if (attackAi is AttackAi_Wait)
                {
                    moveAi   = new MoveAi_Escape(actor, player);
                    attackAi = new AttackAi_Charge(actor, enemyActor.GetStatus().Attackspd, 1, enemyActor.GetStatus().Attackspd);
                }
            }
            #endregion
        }