Esempio n. 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);
    }