public void setupBattle(List <Battler> enemies) { // create children in enemyBattleStation for every enemy in enemy list. (this functionality doesn't suppport bringing in extra enemies) //Instantiate enemy combatUiButtons.transform.GetChild(0).gameObject.transform.position = Camera.main.WorldToScreenPoint(playerBattleStation.transform.position); float i = 0; foreach (Battler enemy in myEnemies) { enemyContainerList.Add(Instantiate(enemy, enemyBattleStation.transform)); enemyContainerList[enemyContainerList.Count - 1].transform.Translate(i, 0, i * 0.25f - 0.25f); enemyContainerList[enemyContainerList.Count - 1].GetComponent <EnemyBattler>().initialize(this); i++; } //Instantiate Cinna and "fuse" cinna = Instantiate(cinnaprefab, playerBattleStation.transform); //Adds Cinna as a child of the Battlestation cinna.transform.Translate(0, 0, 0); cinna.name = "Cinna"; //changes cinna's gameobject name to Cinna for clarity. Unnecessary for code playerContainerList.Add(cinna); cinnaBattler = cinna.GetComponent <PlayerBattler>(); cinnaBattler.initialize(this); jumble = Instantiate(fuseprefab, playerBattleStation.transform); jumble.transform.Translate(-1, 0, 0); jumble.name = "Jumble"; playerContainerList.Add(jumble); fuseBattler = jumble.GetComponent <PlayerBattler>(); fuseBattler.initialize(this); state = BattleState.PLAYERTURN; // mainPhase(); }
public void createButtonList(PlayerBattler pb, List <BattleCommand> commandsList) { titleText.text = pb.title + ":"; foreach (var battleCommand in commandsList) { ButtonHolder bh = Instantiate(buttonPrefab, buttonParent); bh.text.text = battleCommand.title; bh.button.onClick.AddListener(() => pb.chooseTurn(battleCommand)); } }