IEnumerator SetupBattle() { //set up enemy and enemy AI // GameObject enemyGO = Instantiate(enemyPrefab); GameObject enemyGO = enemyPrefab; enemy = enemyGO.GetComponent <NPC>(); enemyAI = enemyGO.GetComponent <NPCAI>(); //display starting message dialogueBox.gameObject.SetActive(true); dialogueText.text = "A monster approaches."; //set HUDs enemyHUD.SetEnemyHUD(enemy); playerHUD.SetPlayerHUD(); yield return(new WaitForSeconds(2f)); dialogueText.text = "What will you do?"; yield return(new WaitForSeconds(2f)); dialogueBox.gameObject.SetActive(false); //start the battle, move to player turn state = BattleState.PLAYERTURN; PlayerTurn(); }
IEnumerator SetupBattle() { GameObject playerGO = Instantiate(playerPrefab, playerBattleStation); playerUnit = playerGO.GetComponent <Unit>(); GameObject enemyGo = Instantiate(enemyPrefabs[Random.Range(0, enemyPrefabs.Count)], enemyBattleStation); enemyUnit = enemyGo.GetComponent <Unit>(); //flavour text as soon as battle begins //dialogueText.text = enemyUnit.unitName + " " + enemyUnit.unitJob + "!"; dialogueText.text = enemyUnit.unitName + " Needs your help with something!"; playerHUD.SetHUD(playerUnit); playerHUD.SetEnemyHUD(enemyUnit); yield return(new WaitForSeconds(4f)); state = BattleState.PLAYERTURN; PlayerTurn(); }