/* * Gestiona quien sera el primer pokemon de cada jugador y actualiza la caja de dialogo */ public IEnumerator SetupBattle() { playerUnit.SetUp(playerParty.GetHealthyPokemon()); enemyUnit.SetUp(enemyParty.GetHealthyPokemon()); partyScreen.Init(); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); //siempre seran los del player //Si un string empieza con un $ puedes referenciar otros valoresd dentro del propio string //Si desde una corrutina se quiere iniciar otra, basta con hacer un yield yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Pokemon.Base.Name} appeared.")); ActionSelection(); }
IEnumerator SetupBattle(string dialog = "") { Debug.Log("Setting Up ..."); playerUnit.Setup(playerParty.GetHealthyPokemon()); // playerHud.SetData(playerUnit._Pokemon); wildUnit.Setup(wildPokemon); // wildHud.SetData(wildUnit._Pokemon); Debug.Log("Pokemons Choosed ..."); _partyScreen.Init(); yield return(TransitionManager._instance.TransitionEffect_FadeOut()); dialogBox.SetMoveNames(playerUnit._Pokemon.Moves); string _dialog = $"A wild {wildUnit._Pokemon.Base.Name} appeared!"; yield return(dialogBox.WriteType(_dialog)); // yield return StartCoroutine(ActionSelection_Interaction()); yield return(ChooseFirstTurn()); currentCoroutine = null; }
private void Start() { battleSystem.OnBattleOver += EndBattle; partyScreen.Init(); DialogManager.Instance.OnShowDialog += () => { state = GameState.Dialog; }; DialogManager.Instance.OnCloseDialog += () => { if (state == GameState.Dialog) { state = GameState.FreeRoam; } }; menuController.onBack += () => { state = GameState.FreeRoam; }; menuController.onMenuSelected += OnMenuSelected; }
public IEnumerator SetupBattle() { playerUnit.Clear(); enemyUnit.Clear(); if (!isTrainerBattle) { // Wild Pokemon playerUnit.Setup(playerParty.GetHealthyPokemon()); enemyUnit.Setup(wildPokemon); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Pokemon.Base.Name} appeared.")); } else { // Trainer // Show Trainer and Player playerUnit.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); trainerImage.gameObject.SetActive(true); playerImage.sprite = player.Sprite; trainerImage.sprite = trainer.Sprite; yield return(dialogBox.TypeDialog($"{trainer.Name} want to battle!")); // Send 1st Pokemon of player playerImage.gameObject.SetActive(false); playerUnit.gameObject.SetActive(true); var playerPokemon = playerParty.GetHealthyPokemon(); playerUnit.Setup(playerPokemon); yield return(dialogBox.TypeDialog($"Go {playerPokemon.Base.Name}!")); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); // Send 1st Pokemon of trainer trainerImage.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(true); var enemyPokemon = trainerParty.GetHealthyPokemon(); enemyUnit.Setup(enemyPokemon); yield return(dialogBox.TypeDialog($"{trainer.Name} send out {enemyPokemon.Base.Name}")); } escapeAttempts = 0; partyScreen.Init(); ActionSelection(); }
private void InitAllScreens(Party p_party) { m_partyScreen.Init(p_party); m_characterScreen.Init(p_party); m_tradingScreen.Init(); m_lootScreen.Init(); InitScreen(m_partyScreen); InitScreen(m_characterScreen); InitScreen(m_tradingScreen); InitScreen(m_lootScreen); }
public IEnumerator SetupBattle() { playerUnit.Clear(); enemyUnit.Clear(); if (!isOutlawBattle) { //Wild Animal Battle playerUnit.Setup(playerParty.GetHealthyAnimal()); enemyUnit.Setup(wildAnimal); dialogBox.SetMoveNames(playerUnit.Animal.Moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Animal.Base.Name} attacked!")); } else { //Outlaw Battle //Show Trainer and Outlaw Sprites playerUnit.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); outlawImage.gameObject.SetActive(true); playerImage.sprite = player.Sprite; outlawImage.sprite = outlaw.Sprite; yield return(dialogBox.TypeDialog($"{outlaw.Name} demands a duel!")); // Send out first animal of the outlaw outlawImage.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(true); var enemyAnimal = outlawParty.GetHealthyAnimal(); enemyUnit.Setup(enemyAnimal); yield return(dialogBox.TypeDialog($"{outlaw.Name} sent out {enemyAnimal.Base.Name}!")); // Send out first animal of the player playerImage.gameObject.SetActive(false); playerUnit.gameObject.SetActive(true); var playerAnimal = playerParty.GetHealthyAnimal(); playerUnit.Setup(playerAnimal); yield return(dialogBox.TypeDialog($"Get 'em {playerAnimal.Base.Name}!")); dialogBox.SetMoveNames(playerUnit.Animal.Moves); } escapeAttempts = 0; partyScreen.Init(); ActionSelection(); }
public IEnumerator SetUpBattle() { playerUnit.Clear(); enemyUnit.Clear(); if (!isEnemyBattle) { //random battle playerUnit.SetUp(playerParty.GetHealthyPiece()); enemyUnit.SetUp(wildPiece); dialogBox.SetAbilityName(playerUnit.Piece.Abilities); yield return(dialogBox.TypeDialog($"a {enemyUnit.Piece.Base.Name} is reveald.")); } else { //enemy battle //show player/enemy playerUnit.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); enemyImage.gameObject.SetActive(true); playerImage.sprite = player.Sprite; enemyImage.sprite = enemy.Sprite; yield return(dialogBox.TypeDialog($"{enemy.Name}")); //send out first piece of enemy enemyImage.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(true); var enemyPiece = enemyParty.GetHealthyPiece(); enemyUnit.SetUp(enemyPiece); yield return(dialogBox.TypeDialog($"{enemy.Name} is {enemyPiece.Base.Name}")); //send out first piece of player playerImage.gameObject.SetActive(false); playerUnit.gameObject.SetActive(true); var playerPiece = playerParty.GetHealthyPiece(); playerUnit.SetUp(playerPiece); yield return(dialogBox.TypeDialog($"tag in {playerPiece.Base.Name}")); dialogBox.SetAbilityName(playerUnit.Piece.Abilities); } escapeAttempts = 0; partyscreen.Init(); ActionSelection(); }
//gets the first healthy pokemon in the players party, gets a random enemy pokemon for that area //initilizes the party screen and displays the players moves public IEnumerator SetUpBattle() { playerUnit.Setup(playerParty.GetHealthyPokemon()); enemyUnit.Setup(wildPokemon); partyScreen.Init(); dialogBox.SetMoveNames(playerUnit.pokemon.moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.pokemon.basePokemon.name} appeared!")); //waits for this coroutine to finish instead of a set time ChooseFirstTurn(); }
public IEnumerator SetupBattle() { playerUnit.placementSetUp(servantParty.GetHealthyServant()); enemyUnit.placementSetUp(wildServant); partyScreen.Init(); dialogBox.SetMoveNames(playerUnit.servantInfo.Moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.servantInfo.servantBase.Name} appeared.")); ActionSelection(); }
//This is the start of the battle, everything gets set up here private IEnumerator SetupBattle() { PlayerUnit.Clear(); EnemyUnit.Clear(); if (!isTrainerBattle) { //wild battle PlayerUnit.Setup(playerParty.GetHealtyPokemon()); EnemyUnit.Setup(wildPokemon); dialogBox.SetMoveNames(PlayerUnit.Pokemon.Moves); yield return(StartCoroutine(dialogBox.TypeDialog($"A wild {EnemyUnit.Pokemon.Base.Name} appeared!"))); } else { //trainer battle //show trainer sprites PlayerUnit.gameObject.SetActive(false); EnemyUnit.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); trainerImage.gameObject.SetActive(true); playerImage.sprite = player.Sprite; trainerImage.sprite = trainer.Sprite; yield return(dialogBox.TypeDialog($"{trainer.Name} wants to battle!")); trainerImage.gameObject.SetActive(false); EnemyUnit.gameObject.SetActive(true); var enemyPokemon = trainerParty.GetHealtyPokemon(); EnemyUnit.Setup(enemyPokemon); yield return(dialogBox.TypeDialog($"{trainer.Name} sends out {enemyPokemon.Base.Name}!")); playerImage.gameObject.SetActive(false); PlayerUnit.gameObject.SetActive(true); var playerPokemon = playerParty.GetHealtyPokemon(); PlayerUnit.Setup(playerPokemon); yield return(dialogBox.TypeDialog($"Go {playerPokemon.Base.Name}!")); dialogBox.SetMoveNames(PlayerUnit.Pokemon.Moves); } escapeAttempts = 0; partyScreen.Init(); ActionSelection(); }
public IEnumerator SetupBattle() { playerUnit.Setup(playerParty.GetHealthyPokemon()); // playerHud.SetData(playerUnit.Pokemon); enemyUnit.Setup(wildpokemon); // enemyHud.SetData(enemyUnit.Pokemon); partyScreen.Init(); dialogBox.SetMoveName(playerUnit.Pokemon.Moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Pokemon.Base.Name} appeared. ")); ChooseFirstTurn(); //ActionSelection(); }
public IEnumerator SetupBattle() { playerUnit.Setup(playerParty.GetHealthyPokemon()); enemyUnit.Setup(wildPokemon); yield return(new WaitForSeconds(1f)); playerUnit.PlayShinyAnimation(); enemyUnit.PlayShinyAnimation(); partyScreen.Init(); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Pokemon.Base.Name} appeared!")); ActionSelection(); }
// function sets data for both player and enemy public IEnumerator SetupBattle() { // setup player playerUnit.Setup(playersParty.GetHealthyTeras()); // setup enemy enemyUnit.Setup(wild); partyScreen.Init(); // set skills of player dialogBox.SetSkillNames(playerUnit.teras.Skills); // encounter message yield return(StartCoroutine(dialogBox.TypeDialog($"Encountered a wild {enemyUnit.teras._baseTeras.Name}!"))); PlayerAction(); ActionSelectionHandler(); }
//Lance les fonctions de la bataille public IEnumerator SetupBattle() { //Configure le playerUnit et l'enemyUnit playerUnit.Setup(playerParty.GetHealthyPokemon()); enemyUnit.Setup(wildPokemon); //Définit les données du playerHud et de l'enemyHud playerHud.SetData(playerUnit.Pokemon); enemyHud.SetData(enemyUnit.Pokemon); partyScreen.Init(); //Affiche les moves des pokemons du joueur dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); //Stop la coroutine et affiche une phrase yield return(dialogBox.TypeDialog($"A wild {enemyUnit.Pokemon.Base.Name} appeared.")); PlayerAction(); }
private IEnumerator SetupBattle() { //TODO - handle case with no healthy monsters _playerMonster.HideHud(); _enemyMonster.HideHud(); if (!_isCharBattle) { _playerMonster.Setup(_playerParty.GetHealthyMonster()); _enemyMonster.Setup(_wildMonster); _dialogBox.SetMoveList(_playerMonster.Monster.Moves); yield return(_dialogBox.TypeDialog($"You have encountered an enemy {_enemyMonster.Monster.Base.Name}!")); } else { ShowCharacterSprites(); yield return(_dialogBox.TypeDialog($"{_battler.Name} has challenged you to a battle!")); // Deploy enemy monster. _battlerImage.gameObject.SetActive(false); //TODO - animate this _enemyMonster.gameObject.SetActive(true); MonsterObj enemyLeadMonster = _battlerParty.GetHealthyMonster(); _enemyMonster.Setup(enemyLeadMonster); yield return(_dialogBox.TypeDialog($"{_battler.Name} has deployed {enemyLeadMonster.Base.Name} to the battle!")); // Deploy player monster. _playerImage.gameObject.SetActive(false); //TODO - animate this too _playerMonster.gameObject.SetActive(true); MonsterObj playerLeadMonster = _playerParty.GetHealthyMonster(); _playerMonster.Setup(playerLeadMonster); _dialogBox.SetMoveList(_playerMonster.Monster.Moves); yield return(_dialogBox.TypeDialog($"You have deployed {playerLeadMonster.Base.Name} to the battle!")); } _escapeAttempts = 0; _partyScreen.Init(); ActionSelection(); }
public IEnumerator SetupBattle() //We use the data created in the BattleUnit and BattleHud scripts { playerUnit.Clear(); enemyUnit.Clear(); //Everything NOT in the if/else, is common at Trainer and WildPokemon battles if (!isTrainerBattle) { //Wild pokemon battle playerUnit.Setup(playerParty.GetHealthyPokemon()); //Setup both pokemons enemyUnit.Setup(wildPokemon); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); //Enable the moves, and set the right names //We return the function Typedialog yield return(dialogBox.TypeDialog($"Un {enemyUnit.Pokemon.Base.Name} sauvage est apparu.")); //With the $, a string can show a special variable in it } else { //Trainer Battle if (trainer.CustomMusic) { battleDefault.Stop(); bossTheme.Play(); } //Show player and trainer images playerUnit.gameObject.SetActive(false); //Disable both player and enemy pokemons enemyUnit.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); //Enable both player and trainer images trainerImage.gameObject.SetActive(true); playerImage.sprite = player.Sprite; trainerImage.sprite = trainer.Sprite; yield return(dialogBox.TypeDialog($"{trainer.Name} veut se battre !")); //Send out first pokemon of the trainer, disabling image of trainer, enabling image ok pokemon trainerImage.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(true); var enemyPokemon = trainerParty.GetHealthyPokemon(); //Get the first healthy pokemon enemyUnit.Setup(enemyPokemon); //And setup the battle yield return(dialogBox.TypeDialog($"{trainer.Name} envoie {enemyPokemon.Base.Name} !")); playerImage.transform.DOLocalMoveX(-550f, 1f); //animator.SetBool("throw", true); yield return(new WaitForSeconds(0.75f)); //Send out first pokemon of the player playerUnit.gameObject.SetActive(true); playerImage.gameObject.SetActive(false); playerImage.transform.DOLocalMoveX(-274f, 1f); var playerPokemon = playerParty.GetHealthyPokemon(); //Get the first healthy pokemon playerUnit.Setup(playerPokemon); //And setup the battle yield return(dialogBox.TypeDialog($"Go {playerPokemon.Base.Name}! ")); dialogBox.SetMoveNames(playerUnit.Pokemon.Moves); //Enable the moves, and set the right names } escapeAttempts = 0; //Set escape attemp to 0, we'll use it in tryToEscape partyScreen.Init(); //This is the function where the player choose a specific action ActionSelection(); }
private IEnumerator SetupBattle() { battleDialogueBox.SetDialogue(""); if (!isTamerBattle) { // Wild Monster Battle canFlee = true; playerUnit.gameObject.SetActive(true); enemyUnit.gameObject.SetActive(true); playerImage.gameObject.SetActive(false); enemyTamerImage.gameObject.SetActive(false); playerUnit.Setup(playerParty.GetHealthyMonster()); enemyUnit.Setup(wildMonster.Monster); Coroutine playerEnterAnimationCor = StartCoroutine(playerUnit.PlayEnterAnimation()); yield return(enemyUnit.PlayEnterAnimation()); yield return(playerEnterAnimationCor); SetupAttackButtons(playerUnit.Monster.BasicMove, playerUnit.Monster.Moves); yield return(battleDialogueBox.TypeDialogue($"A wild { enemyUnit.Monster.MonsterBase.Name } appeared.")); } else { // Tamer Battle canFlee = false; playerUnit.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(false); playerUnit.HUD.gameObject.SetActive(false); enemyUnit.HUD.gameObject.SetActive(false); playerImage.gameObject.SetActive(true); enemyTamerImage.gameObject.SetActive(true); playerImage.sprite = playerController.BattleSprite; enemyTamerImage.sprite = enemyTamerController.BattleSprite; yield return(battleDialogueBox.TypeDialogue($"{ enemyTamerController.Name } wants to fight.")); // Send out enemy's first monster enemyTamerImage.gameObject.SetActive(false); enemyUnit.gameObject.SetActive(true); Monster enemyMonster = enemyTamerParty.GetHealthyMonster(); enemyUnit.Setup(enemyMonster); Coroutine enemyEnterAnimationCor = StartCoroutine(enemyUnit.PlayEnterAnimation()); yield return(battleDialogueBox.TypeDialogue($"{ enemyTamerController.Name } sent out { enemyMonster.MonsterBase.Name }.")); yield return(enemyEnterAnimationCor); // Send out player's first monster playerImage.gameObject.SetActive(false); playerUnit.gameObject.SetActive(true); Monster playerMonster = playerParty.GetHealthyMonster(); playerUnit.Setup(playerMonster); Coroutine playerEnterAnimationCor = StartCoroutine(playerUnit.PlayEnterAnimation()); yield return(battleDialogueBox.TypeDialogue($"Go { playerMonster.MonsterBase.Name }.")); yield return(playerEnterAnimationCor); SetupAttackButtons(playerMonster.BasicMove, playerMonster.Moves); } partyScreen.Init(); ActionSelection(); SetActionsButtonsInteractable(true); }