public void StartBattle(string myPokemonName, string enemyPokemonName) { PokemonInfo myInfo, enemyInfo; PlayerControllerEvent.Trigger(false); _uiManager.gameObject.SetActive(true); if (!PokemonManager.GetPokemonInfo(myPokemonName, out myInfo)) { return; } if (!PokemonManager.GetPokemonInfo(enemyPokemonName, out enemyInfo)) { return; } _myPokemon.SetInfo(myInfo); _enemyPokemon.SetInfo(enemyInfo); _state = BattleState.Start; _uiManager.SetActive(false); _uiManager._mainUI.Init(); _uiManager._mainUI.UpdatePlayerImage(false); _uiManager._mainUI.UpdateEnemyImage(false); _uiManager._mainUI.UpdateValue(_myPokemon, _enemyPokemon, 10, 10, 0f, 100f); _uiManager._bottomUI._skill.Init(); _uiManager._bottomUI._skill.SetPokemon(_myPokemon); _uiManager._bottomUI._skill.UpdateText(); _uiManager._skillClass.Init(); var bgmManager = BgmManager.Instance; AudioClip currentMusic = bgmManager.GetComponent <AudioSource>().clip; _prevTrack = "Null"; // 고쳐주길 바람 // for (int i = 0; i < bgmManager._sounds.Count; i++) // { // if (bgmManager._sounds[i]._clip2 == currentMusic) { _prevTrack = i; break; } // } BgmManager.Instance.Pause(); BgmManager.Instance.Play(_battleTrack, true); StartCoroutine("StartBattleCoroutine"); }
// 다음에 적이 사용할 스킬 private Skill NextEnemySkill() { int enemySkillLength = _enemyPokemon.Info._skills.Length; Skill enemySkill = _enemyPokemon.UseSkill(Random.Range(0, enemySkillLength)); if (enemySkill._currentCount <= 0) { enemySkill = PokemonManager.DefaultSkill(); } enemySkill._currentCount--; return(enemySkill); }
public void UseSkill(int indexOfSkill) { _state = BattleState.Act; Skill playerSkill = _myPokemon?.UseSkill(indexOfSkill); if (playerSkill._currentCount <= 0) { playerSkill = PokemonManager.DefaultSkill(); } playerSkill._currentCount--; _uiManager._mainUI.UpdateMainUI(PokemonBattleMainUI.UIState.Battle); _uiManager._bottomUI.UpdateDialog(); StartCoroutine(ActPhase(playerSkill._battleEvent, NextEnemySkill()._battleEvent)); }
public void StartBattle(string myPokemonName, string enemyPokemonName) { PokemonInfo myInfo, enemyInfo; PlayerControllerEvent.Trigger(false); _uiManager.gameObject.SetActive(true); if (!PokemonManager.GetPokemonInfo(myPokemonName, out myInfo)) { return; } if (!PokemonManager.GetPokemonInfo(enemyPokemonName, out enemyInfo)) { return; } _myPokemon.SetInfo(myInfo); _enemyPokemon.SetInfo(enemyInfo); _state = BattleState.Start; _uiManager.SetActive(false); _uiManager._mainUI.Init(); _uiManager._mainUI.UpdatePlayerImage(false); _uiManager._mainUI.UpdateEnemyImage(false); _uiManager._mainUI.UpdateValue(_myPokemon, _enemyPokemon, 10, 10, 0f, 100f); _uiManager._bottomUI._skill.Init(); _uiManager._bottomUI._skill.SetPokemon(_myPokemon); _uiManager._bottomUI._skill.UpdateText(); _uiManager._skillClass.Init(); _prevTrack = BgmManager.Instance.CurrentTrack; BgmManager.Instance.Play(_battleTrack, true); StartCoroutine("StartBattleCoroutine"); }