Beispiel #1
0
 void SetupBattle()
 {
     player0Hud.SetHud(player0unit);
     player0Hud.SetHud(player1unit);
     player0Hud.SetHud(player2unit);
     player0Hud.SetHud(player3unit);
 }
Beispiel #2
0
    IEnumerator SetupBattle()
    {
        //instantiate the player, make it a child off the player battle station.
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        //create a variable called "playerUnit" which is basically the script attached to the player we instantiated.
        playerUnit = playerGO.GetComponent <Unit>();


        //same as above but for enemy
        GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGO.GetComponent <Unit>();


        //change the text at the bottom of the screen to show which enemy appeared
        dialogueText.text = "A wild " + enemyUnit.unitName + " approachs";

        //calls the script playerHUD and enemyHUD and calls the function setHUD from that script, that sets the HP bar/name/level of enemy
        // and displays it on screen
        playerHUD.SetHud(playerUnit);
        enemyHUD.SetHud(enemyUnit);

        //wait 2 seconds
        yield return(new WaitForSeconds(2f));

        //change the enum to PLAYERTURN and then call the function playerturn;
        state = BattleState.PLAYERTURN;
        playerTurn();
    }
    IEnumerator SetUpBattle()
    {
        GameObject playerGo = Instantiate(PlayerPrefab, PlayerBattleStation);

        playerUnit      = playerGo.GetComponent <Unit>();
        PlayerAnimation = playerGo.GetComponentInChildren <Animator>();

        GameObject Party2Go = Instantiate(PartyMember2Prefab, PartyMember2Station);

        Party2Unit = Party2Go.GetComponent <Unit>();

        if (PlayerInfo.EnemyName == "Big Bad Tree")
        {
            GameObject enemyGo = Instantiate(BossPrefab, EnemyBattleStattion);
            enemyUnit = enemyGo.GetComponent <Unit>();
        }
        else
        {
            GameObject enemyGo = Instantiate(EnemyPrefab, EnemyBattleStattion);
            enemyUnit = enemyGo.GetComponent <Unit>();
        }

        dialogueText.text = "Monster " + enemyUnit.unitName + " attacks!";

        if (PlayerInfo.BattleNumber > 0)
        {
            SetStats();
        }

        SetEnemyStats();

        playerHud.SetHud(playerUnit);
        Party2Hud.SetHud(Party2Unit);
        enemyHud.SetHud(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }