Esempio n. 1
0
    //simp;le set up to show player and enemy set up
    public IEnumerator SetUpBattle()
    {
        playerUnit.Clear();
        enemyUnit.Clear();

        if (!isTrainerBattle)
        {
            //wild creature battle
            playerUnit.Setup(playerteam.GetHealthyCreature());
            enemyUnit.Setup(wildCreature);
            //using string interprilation to bring in game spacific text
            yield return(dialogueBox.TypeDialog($"A wild {enemyUnit.Creature.Base.Name} appeared"));
        }
        else
        {
            //trainer battle
            //set inactive creature sprites and activae trainer sprites
            //enemyUnit.Setup(trainerteam.GetHealthyCreature());
            //playerUnit.Setup(playerteam.GetHealthyCreature());

            playerUnit.gameObject.SetActive(false);
            enemyUnit.gameObject.SetActive(false);

            playerImage.gameObject.SetActive(true);
            trainerImage.gameObject.SetActive(true);
            playerImage.sprite  = player.PlayerSprite;
            trainerImage.sprite = trainer.Sprite;

            yield return(dialogueBox.TypeDialog($"{trainer.Name} wants to fight"));

            //send out trainer creature
            trainerImage.gameObject.SetActive(false);
            enemyUnit.gameObject.SetActive(true);
            var enemyCreature = trainerteam.GetHealthyCreature();
            enemyUnit.Setup(enemyCreature);
            yield return(dialogueBox.TypeDialog($"{trainer.Name} send out {enemyCreature.Base.Name}"));

            //send out player creature
            playerImage.gameObject.SetActive(false);
            playerUnit.gameObject.SetActive(true);
            var playerCreature = playerteam.GetHealthyCreature();
            playerUnit.Setup(playerCreature);
            yield return(dialogueBox.TypeDialog($"Go {playerCreature.Base.Name}"));

            dialogueBox.SetMoveNames(playerUnit.Creature.Moves);
        }

        //set escape attempts to 0
        escapeAttempts = 0;

        battleTeamScreen.Initilised();

        //Passing the creatures moves to the set moves function
        Debug.Log("(playerUnit.Creature is null: " + (playerUnit.Creature == null));
        Debug.Log("(playerUnit.Creature.Moves: " + (playerUnit.Creature.Moves));
        dialogueBox.SetMoveNames(playerUnit.Creature.Moves);

        //wait for a second and then allow the player to choose the next action
        ActionSelection();
    }
Esempio n. 2
0
    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();
    }
Esempio n. 3
0
    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();
    }
Esempio n. 4
0
    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();
    }
Esempio n. 5
0
    //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();
    }
Esempio n. 6
0
    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();
    }