void InitBattle() { SoundManager.Instance.PlayMainSound(battle_clip); account = FileManager.AccountDataLoad("SaveFile/AccountData.txt"); current_stage = "Stage" + (account.Access_currentstage + 1).ToString(); stage = FileManager.StageDataLoad("SaveFile/StageData/" + current_stage + ".txt"); #region 아군 캐릭터 리스트 생성 for (int i = 0; i < account.Access_numofcharacter; i++) { allies.Add(account.Access_character(i)); allies[i].tag = "Ally"; if (allies[i].GetComponent <BarAnimation>() == null) { allies[i].AddComponent <BarAnimation>(); } if (allies[i].GetComponent <AllyCharacter>().Access_atktype == AttackType.Melee) { if (allies[i].GetComponent <MeleeAttack>() == null) { allies[i].AddComponent <MeleeAttack>(); } } else { if (allies[i].GetComponent <RangeAttack>() == null) { allies[i].AddComponent <RangeAttack>(); } } if (allies[i].GetComponent <StatusEffectManager>() == null) { allies[i].AddComponent <StatusEffectManager>(); } } #endregion #region 적군 캐릭터 리스트 생성 for (int i = 0; i < stage.Access_enemylist.Count; i++) { enemies.Add(FileManager.CharacterDataLoad("SaveFile/EnemyData/" + stage.Access_enemylist[i] + ".txt")); enemies[i].tag = "Enemy"; if (enemies[i].GetComponent <BarAnimation>() == null) { enemies[i].AddComponent <BarAnimation>(); } if (enemies[i].GetComponent <EnemyCharacter>().Access_atktype == AttackType.Melee) { if (enemies[i].GetComponent <MeleeAttack>() == null) { enemies[i].AddComponent <MeleeAttack>(); } } else { if (enemies[i].GetComponent <RangeAttack>() == null) { enemies[i].AddComponent <RangeAttack>(); } } if (enemies[i].GetComponent <StatusEffectManager>() == null) { enemies[i].AddComponent <StatusEffectManager>(); } } #endregion SpawnCharacters(allies); // 아군, 적군 리스트를 씬에 소환 SpawnCharacters(enemies); GetComponent <BattleUIManager>().Init(); // 전투 직전 모든 초기화 진행 foreach (GameObject ally in allies) { ally.GetComponent <AllyCharacter>().Init(); } foreach (GameObject enemy in enemies) { enemy.GetComponent <EnemyCharacter>().Init(); } StartCoroutine(update()); }
void InfoSetting(int idx, Transform obj) { obj.GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + account.Access_character(idx).GetComponent <AllyCharacter>().Access_faceimage.ToString()); }