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); }
public void Generate(MapPresenter mapPresenter, ItemModel model) { // item object作成 GameObject res = Resources.Load("Object/" + model.modelName.Replace('_', '/')) as GameObject; Vector2Int pos = mapPresenter.GetPopPoint(); GameObject obj = Object.Instantiate(res, new Vector3(pos.x, 0, pos.y), Quaternion.identity) as GameObject; obj.name = "Item;" + serialGuid; obj.layer = 9; obj.transform.parent = transform; // item model作成 ItemPresenter itemPresenter = obj.AddComponent <ItemPresenter>(); itemPresenter.itemView = obj.AddComponent <ItemView>(); itemPresenter.itemView.model = obj; itemPresenter.Initialize(model, serialGuid); itemPresenter.SetMapData( mapPresenter.GetTileModel(pos.x, pos.y).floorId, new Vector3(pos.x, 0, pos.y), new Vector3(0, 0, -1) ); itemListPresenter[serialGuid] = itemPresenter; itemListObject[serialGuid] = obj; serialGuid++; mapPresenter.SetItemModel(pos.x, pos.y, itemPresenter.status); }
public void Generate(MapPresenter mapPresenter) { for (int x = 0; x < num; x++) { GameObject obj = Object.Instantiate(Resources.Load("Object/Map/Stairs")) as GameObject; Vector2Int pos = mapPresenter.GetPopPoint(); obj.transform.position = new Vector3(pos.x, 0, pos.y); obj.layer = 9; stairsList.Add(obj); //mapに配置 mapPresenter.GetTileModel(pos.x, pos.y).tileType = TileModel.TileType.Stairs; } }