void CreateEnemy() { BattleInfo.BattleModel battle_model = model_.BattleInfoList[0]; foreach (EnemyModel enemy in battle_model.enemy_list) { GameObject enemy_prefab = (GameObject)Resources.Load(enemy.ModelPrefab); GameObject enemy_go = Instantiate(enemy_prefab, enemy_trans_); //GameObject enemy_hpbar_prefab = Resources.Load("Prefab/Battle/UI/PlayerHpBar")as GameObject; GameObject enemy_hpbar_prefab = player_command_info_.PlayerHpBar; HPGauge hp_gauge = Instantiate(enemy_hpbar_prefab, enemy_ui_trans_).GetComponent <HPGauge>(); hp_gauge.SetUp(enemy.Hp); GameObject enemy_damage_text_prehab = player_command_info_.PlayerDamageTextUi; DamageText damage_text = Instantiate(enemy_damage_text_prehab, enemy_ui_trans_).GetComponent <DamageText>(); damage_text.gameObject.SetActive(false); enemy_effect_trans_ = enemy_go.transform.Find("RightHandEffector"); //ここをリスト化した意味は? リスト化したのはデータの更新のため? Enemy enemy_data = enemy_go.GetComponent <Enemy>(); enemy_data.GameObjectBattler = enemy_go; enemy_data.Hpgauge = hp_gauge; enemy_data.MoveTransform = enemy_trans_; enemy_data.EffectTransform = enemy_effect_trans_; enemy_data.Setup(enemy); enemy_list_.Add(enemy_data); enemy_data.DamageText = damage_text; } }
void CreatePlayer() { // 所持キャラ一覧[キャラinfoのidの配列] // // パーティ[キャラinfoのidの配列] List <PlayerInfo> user_chara_list = new List <PlayerInfo>(); BattleInfo.BattleModel battle_model = model_.BattleInfoList[0]; foreach (PlayerModel player in player_info_.PlayerInfoList) { //Summon Playerprefab from PlayerInfo GameObject player_prefab = (GameObject)Resources.Load(player.ModelPrefab); GameObject player_go = Instantiate(player_prefab, player_trans_); //Connect HpGauge and PlayerHp GameObject player_hpbar_prefab = player_command_info_.PlayerHpBar; HPGauge hp_gauge = Instantiate(player_hpbar_prefab, player_ui_trans_).GetComponent <HPGauge>(); hp_gauge.SetUp(player.Hp); GameObject player_damage_text_prehab = player_command_info_.PlayerDamageTextUi; DamageText damage_text = Instantiate(player_damage_text_prehab, player_damage_ui_trans_).GetComponent <DamageText>(); damage_text.gameObject.SetActive(false); //Instance effect_prehab //Heavyknight(Clone)/Crusader_Ctrl_Reference/Crusader_Ctrl_RightHandThumbEffector //player_effect_trans_ = player_go.transform.Find(player.EffectTransform); Transform player_effect_trans = player_go.transform.Find("Crusader_Ctrl_Reference/Crusader_Ctrl_RightHandMiddleEffector"); player_effect_trans_ = GameObject.Find(player.EffectTransform).transform; GameObject effect_prehab = player.Effect; GameObject effect_go = Instantiate(effect_prehab, player_effect_trans_); player_particle_ = effect_go.GetComponent <ParticleSystem>(); //Connect user with PlayerInfo User user_data = player_go.GetComponent <User>(); user_data.GameObjectBattler = player_go; user_data.Hpgauge = hp_gauge; user_data.MoveTransform = player_trans_; user_data.EffectParticle = player_particle_;//New user_data.EffectTransform = player_effect_trans_; user_data.Setup(player); user_list_.Add(user_data); user_data.DamageText = damage_text; } }