Esempio n. 1
0
        // 行動対象がいるかどうかと有効度の判定
        bool IsExistActionTarget(int map_x, int map_y, out int num, out int effective_point_avg, out int effective_point_max, ActionDatas action_datas)
        {
            var game_main = GameMain.GetInstance();
            var g3d_map   = game_main.g3d_map;

            num = 0;
            effective_point_avg = 0;
            effective_point_max = 0;

            foreach (var action in select_unit.bt.actions)
            {
                var ad = ActionDataManager.GetActionData(action.system_name);

                action_target_area.range_min = ad.range_min;
                action_target_area.Check(map_x, map_y, ad.range_max, 1);

                for (var mx = 0; mx < action_target_area.map_w; mx++)
                {
                    for (var my = 0; my < action_target_area.map_h; my++)
                    {
                        if (action_target_area.IsInside(mx, my))
                        {
                            // ここで逆引き的にUnitManagerStatusを取得しているのが胡散臭い(こっちのほうが根っこだから、これもって他方がいいんじゃないかという)
                            // 攻撃範囲だから、mxとmyはそうじゃないとしても…んーそれも微妙かな
                            var my_um     = game_main.unit_manager.GetUnitManagerStatus(select_unit.map_x, select_unit.map_y);
                            var target_um = game_main.unit_manager.GetUnitManagerStatus(mx, my);

                            // ターゲット判定ここでしてるのか...
                            // 味方、敵、自身
                            //if (my_group != target_group)
                            if (UnitManager.IsCheckGroup(my_um, target_um, ad.target_type))
                            {
                                num++;
                                var ep = 5;
                                if (effective_point_max < ep)
                                {
                                    effective_point_max = ep;
                                }
                                if (action_datas != null)
                                {
                                    var a = new Action();
                                    a.command      = action.system_name;
                                    a.target       = game_main.unit_manager.GetUnit(mx, my);
                                    a.target_map_x = mx;
                                    a.target_map_y = my;
                                    action_datas.actions.Add(a);
                                }
                            }
                        }
                    }
                }

                if (num > 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public void SetMode(Mode mode, Point mouse_position, SceneBattle.TurnOnwerUnit tou = null)
        {
            this.mode             = mode;
            command_ui_position.X = mouse_position.X - 12;
            command_ui_position.Y = mouse_position.Y - 12;

            switch (mode)
            {
            case Mode.TurnTopCommandShow:
                command_ui_text_list.Clear();
                if (!tou.end_move)
                {
                    command_ui_text_list.Add(new UserInterface.Command("移動", "移動"));
                }
                if (!tou.end_action)
                {
                    foreach (var a in tou.unit_manager_status.unit.bt.actions)
                    {
                        var ad = ActionDataManager.GetActionData(a.system_name);
                        command_ui_text_list.Add(new UserInterface.Command(ad.view_name, ad.system_name));
                    }
                }
                command_ui_text_list.Add(new UserInterface.Command("ステータス", "ステータス"));
                command_ui_text_list.Add(new UserInterface.Command("待機", "待機"));
                {     // デバック用
                    var scene = GameMain.GetInstance().scene as SceneBattle;
                    if (scene != null)
                    {
                        if (GameMain.GetInstance().debug_status.is_battle_ui_debug_mode)
                        {
                            command_ui_text_list.Add(new UserInterface.Command("AI", "AI"));
                            command_ui_text_list.Add(new UserInterface.Command("Stage Clear", "Stage Clear"));
                            command_ui_text_list.Add(new UserInterface.Command("Game Over", "Game Over"));
                        }
                    }
                }
                break;

            case Mode.SubTopCommandShow:
                command_ui_text_list.Clear();
                command_ui_text_list.Add(new UserInterface.Command("ステータス", "ステータス"));
                break;
            }
        }
Esempio n. 3
0
        public GameMain(GameBase game_base)
        {
            // 根本的な初期化(ここを先にしておかないと差し支えるもの)
            static_main         = this;
            game_base.game_main = this;
            this.game_base      = game_base;

            SFont.Load("data/font/migmix-1p-20150712/migmix-1p-bold.ttf");
            SFont.Load("data/font/migmix-2p-20150712/migmix-2p-regular.ttf");
            //

            // その他の初期化、基本部分
            sound_manager       = new SoundManager();
            model_manager       = new ModelManager();
            action_data_manager = new ActionDataManager();

            // シーン生成
            scene = new SceneSetup("data/script/start.nst");

            // キー入力初期化
            game_base.input.SetupKeyInput((int)KeyCode.DebugView, DX.KEY_INPUT_F3);

            user_interface = new UserInterface();


            DX.SetUseZBufferFlag(DX.TRUE);   // Zバッファを有効にする
            DX.SetWriteZBufferFlag(DX.TRUE);
            //DX.SetUseLighting(DX.FALSE); // ライトを無効にする ライトの調整が難しいので・・・
            DX.SetUseLighting(DX.TRUE);

            //BGM テスト
            //var sound = DX.LoadSoundMem("data/sound/Battle_Boss_01.ogg");
            //DX.PlaySoundMem(sound, DX.DX_PLAYTYPE_LOOP);

            if (is_use_shadowmap)
            {
                // シャドウマップ初期化
                int shadow_map_size = 1024;
                ShadowMapHandle = DX.MakeShadowMap(shadow_map_size, shadow_map_size);
            }
        }
Esempio n. 4
0
        public bool _ScriptLineAnalyze(Script.ScriptLineToken t)
        {
            var game_main = GameMain.GetInstance();
            //var user_interface = game_main.user_interface;
            //var game_base = game_main.game_base;
            //var g3d_camera = game_main.g3d_camera;
            var g3d_map      = game_main.g3d_map;
            var unit_manager = game_main.unit_manager;

            //var action_manager = game_main.action_manager;

            switch (t.command[0])
            {
            case "SetupScene":
                switch (t.command[1])
                {
                case "Battle":
                {
                    var script_path = t.GetString(2);
                    var scene       = new SceneBattle(script_path, false);
                    game_main.NextScene(scene);
                }
                    return(true);

                case "PreBattle":
                {
                    var script_path_pre  = t.GetString(2);
                    var script_path_main = t.GetString(3);
                    var scene            = new ScenePreBattle(script_path_pre, script_path_main);
                    game_main.NextScene(scene);
                }
                    return(true);

                case "CreateMap":
                {
                    //var script_path_pre = t.GetString(2);
                    //var script_path_main = t.GetString(3);
                    var scene = new SceneCreateMap();
                    game_main.NextScene(scene);
                }
                    return(true);
                }
                break;

            case "ConectSound":
            {
                var key_name = t.GetString(1);
                var path     = t.GetString(2);
                SoundManager.ConectSound(key_name, path);
            }
                return(true);

            case "ConectOnePointModel":
            {
                var key_name = t.GetString(1);
                var path     = t.GetString(2);
                ModelManager.ConectOnePointModel(key_name, path);
            }
                return(true);

            case "SetupActionData":
            {
                var path = t.GetString(1);
                ActionDataManager.SetupActionData(path);
            }
                return(true);

            case "SetupClassData":
            {
                var path = t.GetString(1);
                UnitDataManager.AddClassData(path);
            }
                return(true);

            case "DebugMode":
                switch (t.GetString(1))
                {
                case "UI":
                    game_main.debug_status.is_battle_ui_debug_mode = true;
                    return(true);

                case "Auto":
                    game_main.debug_status.is_auto_battle = true;
                    game_main.user_interface.SetMode(UserInterface.Mode.NonePlayerTurn, game_main.game_base.input.mouse_sutatus.position);
                    return(true);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        // todo: 行動させるのと、UI制御が混ざってるので、分離したほうが良さそう
        // 行動の実行できるかどうかについても判定しているからややこしい(AIのところで食い違う…多重チェックになってる)
        public void DoAction(string command, string sub_command, Unit action_unit, int target_map_x, int target_map_y, bool is_user_owner)
        {
            var game_main      = GameMain.GetInstance();
            var user_interface = game_main.user_interface;
            var game_base      = game_main.game_base;
            var g3d_map        = game_main.g3d_map;
            var unit_manager   = game_main.unit_manager;
            var target_unit    = unit_manager.GetUnit(target_map_x, target_map_y);

            var is_inside   = false;
            var action_data = ActionDataManager.GetActionData(command);

            if (!is_user_owner)
            {
                // 自動・NPCでの操作の場合
                g3d_map.ClearRangeAreaEffect();
                g3d_map.SetActionTargetAreaEffect(action_unit.map_x, action_unit.map_y, action_data.range_min, action_data.range_max, 1);
                is_inside = g3d_map.action_target_area.IsInside(target_map_x, target_map_y);
            }
            else
            {
                is_inside = g3d_map.action_target_area.IsInside(target_map_x, target_map_y);
            }

            var is_action_do_ok = false;

            switch (action_data.range_ok_type)
            {
            case "範囲内":     // 範囲内しか行動の実行を認めない
                if (is_inside)
                {
                    is_action_do_ok = true;
                }
                break;

            case "延長可":     // 射程最小値より大きければ、射程最大値外でも行動の実行を認める
                //if (is_inside) action_do_ok = true;
            {
                var range = Math.Abs(target_map_x - action_unit.map_x) + Math.Abs(target_map_y - action_unit.map_y);
                if (range >= action_data.range_min)
                {
                    is_action_do_ok = true;
                }
            }
            break;
            }
            if (!is_action_do_ok)
            {
                // 行動不可なので、中断
                if (is_user_owner)
                {
                    user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                    g3d_map.ClearRangeAreaEffect();
                }
                return;
            }

            // todo: 行動のモーション、サウンドに関わるため、一旦はこのまま(先に他を整理)
            switch (command)
            {
            default:     // 対象が単体のものはこれでいけるはず
            {
                var damage     = 0;
                var is_success = target_unit != null;
                if (is_success)
                {
                    damage = GetDamage(action_unit, target_unit, action_data);
                }
                if (target_unit == null)
                {
                    // ダミーの対象ユニットを作成しておく
                    target_unit = new Unit(target_map_x, target_map_y);
                }
                else
                {
                    // 攻撃の場合、ダメージでHPが0になる場合、この時点で、戦闘不能予約をしておく
                    if (action_data.type == "攻撃")
                    {
                        var hp = target_unit.bt.status["HP"].now - damage;
                        if (hp <= 0)
                        {
                            target_unit.bt.is_reserve_dead = true;
                        }
                    }
                }

                var action = new ScriptConector.BattleMapEffectScriptConector(action_data.script_path, is_success, damage, action_unit, target_unit);
                ScriptConector.BattleMapEffectScriptConectorManager.Add(action);
            }
            break;
            }
            if (is_user_owner)
            {
                user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                g3d_map.ClearRangeAreaEffect();
            }

            // 手番ユニットの行動済みを設定
            if (!game_main.debug_status.is_battle_ui_debug_mode)
            {
                turn_owner_unit.end_action = true;
            }
        }
Esempio n. 6
0
        void _Update_KeyInput()
        {
            var game_main      = GameMain.GetInstance();
            var user_interface = game_main.user_interface;
            var game_base      = game_main.game_base;
            var g3d_camera     = game_main.g3d_camera;
            var g3d_map        = game_main.g3d_map;
            var unit_manager   = game_main.unit_manager;

            user_interface.Update(game_base.input.mouse_sutatus.position);

            if (game_main.action_manager.IsControlFreese() || game_main.battle_map_effect_script_conector_manager.IsControlFreese())
            {
                g3d_map.is_draw_cursor_turn_owner = false;
                return;
            }
            else
            {
                g3d_map.is_draw_cursor_turn_owner = true;
            }

            //
            if (DX.CheckHitKey(DX.KEY_INPUT_Q) == DX.TRUE)
            {
                g3d_camera.AddRot(0.03f);
            }
            if (DX.CheckHitKey(DX.KEY_INPUT_E) == DX.TRUE)
            {
                g3d_camera.AddRot(-0.03f);
            }
            if (DX.CheckHitKey(DX.KEY_INPUT_A) == DX.TRUE)
            {
                g3d_camera.MoveYRot(1.00f, 90);
            }
            if (DX.CheckHitKey(DX.KEY_INPUT_D) == DX.TRUE)
            {
                g3d_camera.MoveYRot(1.00f, -90);
            }
            if (DX.CheckHitKey(DX.KEY_INPUT_S) == DX.TRUE)
            {
                g3d_camera.MoveFront(-1.0f);
            }
            if (DX.CheckHitKey(DX.KEY_INPUT_W) == DX.TRUE)
            {
                g3d_camera.MoveFront(1.0f);
            }

            if (DX.CheckHitKey(DX.KEY_INPUT_F) == DX.TRUE)
            {
                //g3d_camera.MoveFront(1.0f);
                g3d_map.SetMoveRouteEffect(g3d_map.map_cursor_x, g3d_map.map_cursor_y);
            }

            if (game_base.input.GetKeyInputStatus((int)GameMain.KeyCode.DebugView) == Input.KeyInputStatus.Up)
            {
                game_main.debug_is_view = !game_main.debug_is_view;
            }

            //if (user_interface.mode == UserInterface.Mode.NonePlayerTurn)
            if (battle_ai != null)
            {
                if (battle_ai.GetIsEnd())
                {
                    battle_ai = null;
                    user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                    NextUnitTurn();
                }
            }
            else if (game_base.input.mouse_sutatus.left.key_status == Input.MouseButtonKeyStatus.OneCrick)
            {
                if (user_interface.IsHitUI()) // UIへの入力
                {
                    var command     = user_interface.GetHitUICommand();
                    var action_data = ActionDataManager.GetActionData(command.system_name);
                    switch (user_interface.mode)
                    {
                    case UserInterface.Mode.TurnTopCommandShow:
                        select_command = command;
                        switch (command.system_name)
                        {
                        default:
                            if (action_data != null)
                            {
                                user_interface.SetMode(UserInterface.Mode.AtackTargetSelect, game_base.input.mouse_sutatus.position);
                                user_interface.mode_param1 = action_data.range_type;
                                g3d_map.ClearRangeAreaEffect();
                                g3d_map.SetActionTargetAreaEffect(select_unit.map_x, select_unit.map_y, action_data.range_min, action_data.range_max, 1);
                            }
                            else
                            {
                                user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                                g3d_map.ClearRangeAreaEffect();
                            }
                            break;

                        case "移動":
                            user_interface.SetMode(UserInterface.Mode.MovePointSelect, game_base.input.mouse_sutatus.position);
                            break;

                        case "待機":
                            _Update_KeyInput_TurnOnwerEnd();
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            g3d_map.ClearRangeAreaEffect();
                            break;

                        case "ステータス":
                            user_interface.SetMode(UserInterface.Mode.UnitStatusView, game_base.input.mouse_sutatus.position);
                            user_interface.SetStatusUnit(select_unit);
                            g3d_map.ClearRangeAreaEffect();
                            break;

                        case "AI":
                            user_interface.SetMode(UserInterface.Mode.NonePlayerTurn, game_base.input.mouse_sutatus.position);
                            g3d_map.ClearRangeAreaEffect();
                            battle_ai = new BattleAI(this, select_unit);
                            break;

                        case "Game Over":
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            game_main.NextScene(new SceneEndBattle("Game Over", ""));
                            break;

                        case "Stage Clear":
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            game_main.NextScene(new SceneEndBattle("Stage Clear", ""));
                            break;
                        }
                        break;

                    case UserInterface.Mode.SubTopCommandShow:
                        select_command = command;
                        switch (command.system_name)
                        {
                        default:
                            if (action_data != null)
                            {
                                user_interface.SetMode(UserInterface.Mode.AtackTargetSelect, game_base.input.mouse_sutatus.position);
                                user_interface.mode_param1 = action_data.range_type;
                                g3d_map.ClearRangeAreaEffect();
                                g3d_map.SetActionTargetAreaEffect(select_unit.map_x, select_unit.map_y, action_data.range_min, action_data.range_max, 1);
                            }
                            else
                            {
                                user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                                g3d_map.ClearRangeAreaEffect();
                            }
                            break;

                        case "ステータス":
                            user_interface.SetMode(UserInterface.Mode.UnitStatusView, game_base.input.mouse_sutatus.position);
                            user_interface.SetStatusUnit(select_unit);
                            g3d_map.ClearRangeAreaEffect();
                            break;
                            //case "AI":
                            //    user_interface.SetMode(UserInterface.Mode.NonePlayerTurn, game_base.input.mouse_sutatus.position);
                            //    g3d_map.ClearRangeAreaEffect();
                            //    battle_ai = new BattleAI(this, select_unit);
                            //    break;
                        }
                        break;
                    }
                }
                else if (g3d_map.map_cursor_x >= 0 && g3d_map.map_cursor_y >= 0) // 3Dマップへの入力
                {
                    switch (user_interface.mode)
                    {
                    case UserInterface.Mode.MovePointSelect:     // 移動選択
                    {
                        var is_inside = g3d_map.move_area.IsInside(g3d_map.map_cursor_x, g3d_map.map_cursor_y);
                        if (is_inside)
                        {         // 移動範囲内
                            select_unit.Move(g3d_map.map_cursor_x, g3d_map.map_cursor_y, true);
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            if (!game_main.debug_status.is_battle_ui_debug_mode)
                            {
                                turn_owner_unit.end_move = true;
                            }
                        }
                        else
                        {         // 移動範囲外
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                        }
                        g3d_map.ClearRangeAreaEffect();
                    }
                    break;

                    case UserInterface.Mode.AtackTargetSelect:     // 攻撃対象選択
                    {
                        DoAction(select_command.system_name, user_interface.mode_param1, select_unit, g3d_map.map_cursor_x, g3d_map.map_cursor_y, true);
                    }
                    break;

                    case UserInterface.Mode.UnitStatusView:
                        user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                        break;

                    default:
                    {
                        var u = unit_manager.GetUnit(g3d_map.map_cursor_x, g3d_map.map_cursor_y);
                        if (game_main.debug_status.is_battle_ui_debug_mode && (u != null))
                        {
                            turn_owner_unit.unit_manager_status = GetUnitManagerStatus(u);
                            g3d_map.SetMoveAreaEffect(g3d_map.map_cursor_x, g3d_map.map_cursor_y, u.bt.status["MOVE"].now, u.bt.status["JUMP"].now, "");
                            user_interface.SetMode(UserInterface.Mode.TurnTopCommandShow, game_base.input.mouse_sutatus.position, turn_owner_unit);
                            select_unit = u;
                        }
                        else if ((u != null) && (u == turn_owner_unit.unit_manager_status.unit))
                        {
                            //if (select_unit == u)
                            //{
                            //    g3d_map.ClearRangeAreaEffect();
                            //    user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            //    select_unit = null;
                            //}
                            //else
                            //{
                            g3d_map.SetMoveAreaEffect(g3d_map.map_cursor_x, g3d_map.map_cursor_y, u.bt.status["MOVE"].now, u.bt.status["JUMP"].now, "");
                            user_interface.SetMode(UserInterface.Mode.TurnTopCommandShow, game_base.input.mouse_sutatus.position, turn_owner_unit);
                            select_unit = u;
                            //}
                        }
                        else if (u != null)
                        {
                            g3d_map.SetMoveAreaEffect(g3d_map.map_cursor_x, g3d_map.map_cursor_y, u.bt.status["MOVE"].now, u.bt.status["JUMP"].now, "");

                            //if(select_unit==u) // 2度クリックしたときはコマンド表示を消す
                            //{
                            //    g3d_map.ClearRangeAreaEffect();
                            //    user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            //    select_unit = null;
                            //}
                            //else
                            //{
                            user_interface.SetMode(UserInterface.Mode.SubTopCommandShow, game_base.input.mouse_sutatus.position, null);
                            select_unit = u;
                            //}
                        }
                        else
                        {
                            g3d_map.ClearRangeAreaEffect();
                            user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                            select_unit = null;
                        }
                    }
                    break;
                    }
                }
            }
            else
            {
                switch (user_interface.mode)
                {
                case UserInterface.Mode.UnitStatusView:
                    //if (!user_interface.IsHitUI())
                    //{
                    //    user_interface.SetMode(UserInterface.Mode.PlayerTurnFree, game_base.input.mouse_sutatus.position);
                    //}
                    break;

                default:
                    if (!user_interface.IsHitUI())
                    {
                        var u = unit_manager.GetUnit(g3d_map.map_cursor_x, g3d_map.map_cursor_y);
                        user_interface.SetStatusUnit(u);
                    }
                    else
                    {
                        user_interface.SetStatusUnit(select_unit);
                    }
                    break;
                }
            }
        }
Esempio n. 7
0
 public ActionDataManager()
 {
     action_data_manager = this;
 }
Esempio n. 8
0
        public void Run()
        {
            var game_main = GameMain.GetInstance();
            var g3d_map   = game_main.g3d_map;

            // まず移動させよう
            // 移動範囲を表示、算出して
            move_area.Check(select_unit.map_x, select_unit.map_y, select_unit.bt.status["MOVE"].now, select_unit.bt.status["JUMP"].now);

            // 移動できる場所をリストアップ
            var move_point_list = new List <MovePoint>();

            for (var mx = 0; mx < move_area.map_w; mx++)
            {
                for (var my = 0; my < move_area.map_h; my++)
                {
                    if (move_area.IsInside(mx, my))
                    {
                        var mp = new MovePoint();
                        mp.map_x      = mx;
                        mp.map_y      = my;
                        mp.evaluation = 0; //とりあえず初期値
                        move_point_list.Add(mp);
                    }
                }
            }
            { // 移動しない場合
                var mp = new MovePoint();
                mp.map_x = select_unit.map_x;
                mp.map_y = select_unit.map_y;
                move_point_list.Add(mp);
            }

            // 移動できる場所を判定
            MovePoint max_mp        = null;
            var       max_evalution = 0.0;

            foreach (var mp in move_point_list)
            {
                var evalution = 0.0;
                CalcMoveEvalution(mp);
                evalution = mp.evaluation * 3;
                var rs = CalcRangeStatus(mp.map_x, mp.map_y, false);
                evalution += (-rs.evaluation_min) / 5 + (-rs.evaluation_avg) / 10;

                //Console.WriteLine("{0},{1} ({2}) {3}  {4}", mp.map_x,mp.map_y, mp.evaluation, rs.evaluation_min, rs.evaluation_avg);

                if (max_mp == null || max_evalution < evalution)
                {
                    max_evalution = evalution;
                    max_mp        = mp;
                }
            }
            Thread.Sleep(100);

            // 移動を実行
            if (max_mp.map_x != select_unit.map_x || max_mp.map_y != select_unit.map_y)
            {
                var t = new STask((param) =>
                {
                    select_unit.Move(max_mp.map_x, max_mp.map_y, true);
                    GameMain.GetInstance().g3d_map.ClearRangeAreaEffect();
                }, null);
                STaskManager.Add(t);
                t.WaitEnd();
            }
            Console.WriteLine("pos " + select_unit.map_x + "," + select_unit.map_y);

            Thread.Sleep(100);
            // 行動を決める
            {
                var action_datas = new ActionDatas();
                int num, effective_point_avg, effective_point_max;
                if (IsExistActionTarget(max_mp.map_x, max_mp.map_y, out num, out effective_point_avg, out effective_point_max, action_datas))
                {
                    Console.WriteLine("----A");
                    Console.WriteLine("pos " + select_unit.map_x + "," + select_unit.map_y);
                    var t = new STask((param) =>
                    {
                        var a  = action_datas.actions[0];
                        var ad = ActionDataManager.GetActionData(a.command);

                        var target_unit = game_main.unit_manager.GetUnit(a.target_map_x, a.target_map_y);
                        if (target_unit != null)
                        {
                            game_main.user_interface.SetStatusUnit(target_unit);
                        }

                        Console.WriteLine("DoAction {0} {1} {2} {3}", a.command, ad.range_type, select_unit.name, a.target.name);
                        scene_battle.DoAction(a.command, ad.range_type, select_unit, a.target_map_x, a.target_map_y, false);
                    }, null);
                    Console.WriteLine("----B");
                    Console.WriteLine("pos " + select_unit.map_x + "," + select_unit.map_y);
                    STaskManager.Add(t);
                    Console.WriteLine("----C");
                    Console.WriteLine("pos " + select_unit.map_x + "," + select_unit.map_y);
                    t.WaitEnd();
                }
            }
            Thread.Sleep(100);
            g3d_map.ClearRangeAreaEffect();

            //Thread.Sleep(1000);
            //scene_battle.NextUnitTurn();

            is_thread_end = true;
            Console.WriteLine("BattleAI Run End");
        }