Beispiel #1
0
    void Start()
    {
        ActionLogPresenter.CreateInstance();
        ItemData.Load();
        EnemyData.Load();
        PlayerData.Load();

        //map 生成
        mapPresenter.Generate();

        //enemy生成
        List <UserModel> enemies = EnemyData.GetRandoms(50);

        enemies.ForEach(enemy =>
        {
            Vector2Int _pos  = mapPresenter.GetPopPoint();
            UserModel _model = characterListPresenter.Generate(_pos, mapPresenter.GetTileModel(_pos.x, _pos.y).floorId, enemy);
            mapPresenter.SetUserModel(_pos, _model);
        });

        //player生成
        UserModel player = PlayerData.GetRandom();

        player.isOwn = true;

        Vector2Int position = mapPresenter.GetPopPoint();
        UserModel  model    = characterListPresenter.Generate(position, mapPresenter.GetTileModel(position.x, position.y).floorId, player);

        mapPresenter.SetUserModel(position, model);

        gameStatus = new GameStatusModel();

        //item 配置
        List <ItemModel> items = ItemData.GetRandoms(50);

        items.ForEach(item => itemsListPresenter.Generate(mapPresenter, item));

        //階段配置
        stairsListPresenter.Generate(mapPresenter);

        //dummy エネミー配置
        //enemiesListPresenter.DummyGenerate(mapPresenter, mapPresenter.CanSetObject(pos));

        //dummy 階段配置
        Vector2Int pos = mapPresenter.GetPopPoint();

        stairsListPresenter.DummyGenerate(mapPresenter, mapPresenter.CanSetObject(pos));

        CharacterPresenter characterPresenter = characterListPresenter.GetOwnCharacterPresenter();

        characterPresenter.characterView.Equip("");
        menuPresenter.itemMenuPresenter.Initialize(characterPresenter.itemModels);

        //Create Hud
        GameObject res = Resources.Load("Object/Hud") as GameObject;
        GameObject obj = UnityEngine.Object.Instantiate(res, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        hudPresenter = obj.GetComponent <HudPresenter>();
        hudPresenter.UpdateHud(characterPresenter.status);
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        var characterPresenter = characterListPresenter.GetOwnCharacterPresenter();

        //var conf = ConfigProvider.Api;
        //rest_map=1,dungen_map=2
        if (phase == 1)
        {
        }
        else if (phase == 2)
        {
            //user_turn=1,enemy_turn=2
            if (gameStatus.turn == 1)
            {
                if (Input.GetKeyDown(KeyCode.I))
                {
                    menuPresenter.itemMenuPresenter.ShowView(!menuPresenter.itemMenuPresenter.GetIsShowItemMenu());
                }

                if (Input.GetKeyDown(KeyCode.N))
                {
                    ActionLogPresenter.Instance.SwitchShowView();
                }

                if (Input.GetKeyDown(KeyCode.L))
                {
                    mapPresenter.ShowMapInfo();
                }

                // アイテムメニュー開いているか
                if (!menuPresenter.itemMenuPresenter.GetIsShowItemMenu())
                {
                    DefaultAction(characterPresenter);
                }
                else
                {
                    ItemMenuAction(characterPresenter);
                }

                //自分が動いたら敵のターンにする
                if (characterPresenter.status.isAction)
                {
                    hudPresenter.UpdateHud(characterPresenter.status);
                    SetTurn(2);
                    Resources.UnloadUnusedAssets();
                }
            }
            else if (gameStatus.turn == 2)
            {
                //敵が全部動いていればユーザーのターンにする
                if (characterListPresenter.IsAllAction())
                {
                    characterPresenter.status.isAction = false;
                    SetTurn(1);
                    Resources.UnloadUnusedAssets();
                }
            }
        }
    }