示例#1
0
    //setup all the information of the start of battle
    public IEnumerator SetupBattle()
    {
        state = BattleState.START;

        battleCam.enabled = true;
        playerPokemon     = PokemonFactory.Create(5, "Charizard");
        //enemyPokemon = PokemonFactory.CreateRandom();
        enemyPokemon = PokemonFactory.CreateRandom();
        //Added more moves to the player for testing
        Move        move2      = new Move("Fire Stuff");
        Move        move3      = new Move("Fire Blast");
        Move        move4      = new Move("Fly");
        List <Move> MovesToadd = new List <Move> {
            move2, move3, move4
        };

        playerPokemon.moves.AddRange(MovesToadd);

        dialogText.text = "A crazy " + enemyPokemon.name + " appeared";

        SetHud();
        AssingMoves();

        yield return(new WaitForSeconds(1.5f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        player = PokemonSelect.player;
        enemy  = PokemonFactory.CreateRandom();

        playerPokemon.text = player.name;
        playerLvl.text     = "Lv" + player.level.ToString();
        playerHp.maxValue  = player.maxHp;

        enemyPokemon.text = enemy.name;
        enemyLvl.text     = "Lv" + enemy.level.ToString();
        enemyHp.maxValue  = enemy.maxHp;

        playerHp.value = player.hp;
        enemyHp.value  = enemy.hp;
        UpdateHp(player);
        UpdateHp(enemy);
        actionText.text = "";

        if (player.moves.Count == 2)
        {
            move1.gameObject.SetActive(true);
            move2.gameObject.SetActive(true);
            move1.GetComponentInChildren <Text>().text = player.moves[0].name;
            move2.GetComponentInChildren <Text>().text = player.moves[1].name;
        }
        else if (player.moves.Count == 1)
        {
            move1.gameObject.SetActive(true);
            move1.GetComponentInChildren <Text>().text = player.moves[0].name;
        }
        StartCoroutine(TextTyper(actionText, "Choose your next move"));
        Invoke("SetFightLoop", 1f);
    }
 void RandomEncounter()
 {
     enemyPokemon = PokemonFactory.CreateRandom();
 }