コード例 #1
0
ファイル: Unit.cs プロジェクト: pogin503/TOL_SRPG
        public Unit(string class_name, string model_path, string image_face_path, string name, int map_x, int map_y, int color_no = 0, int direction = 2)
        {
            bt.class_name = class_name;
            Setup();
            var ucd = UnitDataManager.GetUnitClassData(bt.class_name);

            if (model_path == "")
            {
                model_path = ucd.model_default_path;
            }
            if (image_face_path == "")
            {
                image_face_path = ucd.image_default_path;
            }

            model      = new G3DModel(model_path);
            image_face = DX.LoadGraph(image_face_path);

            this.name      = name;
            this.direction = direction;

            script = new Script(model.model_root_dir + "system.nst", _ScriptLineAnalyze);
            script.Run("Setup");
            //script.Run("Status");

            SetMotion("歩行");
            Move(map_x, map_y, true);
            model.RotAdd(0, (float)(-Math.PI * direction / 2.0), 0);


            if (color_no != 0)
            {
                SetColor(color_no);
            }
        }
コード例 #2
0
ファイル: Unit.cs プロジェクト: pogin503/TOL_SRPG
        private void Setup()
        {
            var ucd = UnitDataManager.GetUnitClassData(bt.class_name);

            foreach (var st in ucd.status)
            {
                var bts = new BTS(st.Value.default_value);
                bt.status.Add(st.Key, bts);
            }
            foreach (var ad in ucd.actions)
            {
                var a = new ActionStatus();
                a.system_name   = ad.system_name;
                a.reflect_point = ad.reflect_point;
                bt.actions.Add(a);
            }
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: UnitData.cs プロジェクト: pogin503/TOL_SRPG
 public UnitDataManager()
 {
     unit_data_manager = this;
 }
コード例 #5
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 "MapLoad":
            {
                var map_path = t.GetString(1);
                g3d_map.Load(map_path);
            }
                return(true);

            case "MapData":
            {
                var size = t.command.Count();
                for (var i = 1; i < size; i++)
                {
                    setup_script_data.map_data.Add(t.GetInt(i));
                }
                setup_script_data.map_w = size - 1;
            }
                return(true);

            case "MapSetup":
            {
                setup_script_data.map_h = setup_script_data.map_data.Count() / setup_script_data.map_w;
                g3d_map.map_w           = setup_script_data.map_w;
                g3d_map.map_h           = setup_script_data.map_h;

                g3d_map.Setup(setup_script_data.map_data.ToArray());
            }
                return(true);

            case "Unit":
            {
                var x = t.GetInt(1);
                var y = t.GetInt(2);
                var unit_class_name = t.GetString(3);
                var ucd             = UnitDataManager.GetUnitClassData(unit_class_name);
                var model_path      = t.GetString(4);
                var image_face_path = t.GetString(5);

                var name      = t.GetString(6);
                var group     = t.GetString(7);
                var color_no  = t.GetInt(8);
                var direction = t.GetInt(9);

                if (!(is_continue_player_unit && group == "味方"))
                {
                    var unit = new Unit(unit_class_name, model_path, image_face_path, name, x, y, color_no, direction);
                    unit_manager.Join(unit, group);
                }
            }
                //unit_manager.Join(new Unit(path, 3, 5, 1, 0), "敵");
                return(true);
            }
            return(false);
        }
コード例 #6
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 "MapData":
            //    {
            //        var size = t.command.Count();
            //        for (var i = 1; i < size; i++)
            //        {
            //            setup_script_data.map_data.Add(t.GetInt(i));
            //        }
            //        setup_script_data.map_w = size - 1;
            //    }
            //    break;
            //case "MapSetup":
            //    {
            //        setup_script_data.map_h = setup_script_data.map_data.Count() / setup_script_data.map_w;
            //        g3d_map.map_w = setup_script_data.map_w;
            //        g3d_map.map_h = setup_script_data.map_h;

            //        g3d_map.Setup(setup_script_data.map_data.ToArray());

            //    }
            //    break;
            case "Unit":
            {
                var x = t.GetInt(1);
                var y = t.GetInt(2);
                var unit_class_name = t.GetString(3);
                var ucd             = UnitDataManager.GetUnitClassData(unit_class_name);
                var model_path      = "data/model/" + t.GetString(4) + "/_.pmd";
                var image_face_path = "data/image/face/" + t.GetString(5);

                // 下記のifはUnitのコンストラクタで処理しても良い?
                if (t.GetString(4) == "")
                {
                    model_path = ucd.model_default_path;
                }
                if (t.GetString(5) == "")
                {
                    image_face_path = ucd.image_default_path;
                }

                var name      = t.GetString(6);
                var group     = t.GetString(7);
                var color_no  = t.GetInt(8);
                var direction = t.GetInt(9);
                var unit      = new Unit(unit_class_name, model_path, image_face_path, name, x, y, color_no, direction);
                unit_manager.Join(unit, group);
            }
                //unit_manager.Join(new Unit(path, 3, 5, 1, 0), "敵");
                break;
                //case "DebugMode":
                //    if (t.GetString(1) == "True")
                //    {
                //        is_debug_mode = true;
                //    }
                //    else
                //    {
                //        is_debug_mode = false;
                //    }
                //    break;
            }
            return(false);
        }