public void GenerateAbilityList(Actor actor, List <IUseable> skills) { this.gameObject.SetActive(true); foreach (IUseable skill in skills) { SkillButton temp = GameObject.Instantiate <SkillButton>(abilityButton, contentTransform.contentTransform); temp.InitButton(skill, tooltippanel); temp.ChangeText(skill.GetName()); temp.button.onClick.AddListener(delegate { SkillClicked(skill, actor); }); contentTransform.AddToList(temp); temp.button.interactable = (skill.CanPayCost(actor) && actor.actorData.cooldownMap.IsSKillOnCooldown(skill.GetKey()) == false); } maxIndex = skills.Count - 1; if (maxIndex > 0) { AdjustMenu(0); } }
// Start is called before the first frame update void Start() { SetBossHealthSlider(1f); //Set the player's button image. It won't have any other functionality PlayerHealerButton.faceReferences = TeammateFacesList[TeammateFacesList.Count - 1]; PlayerHealerButton.SetButtonImageFromMood(TeamMateMood.NEUTRAL); for (int s = 0; s < TOTAL_SKILLS; s++) { SkillButton skillButton = Instantiate(skillButtonPrefab); skillButton.transform.SetParent(skillButtonParent, false); skillButton.skill = gameController.Healer.GetSkillByType((SkillType)s); skillButton.playerHealerButton = PlayerHealerButton; skillButton.InitButton(s); skillButtons.Add(skillButton); int index = s; //Need to manually seperate the index skillButton.uiButton.onClick.AddListener(delegate { OnSkillButtonPressed(index); }); } for (int t = 0, count = gameController.TeamMates.Count; t < count; t++) { TeamMateButton tmButton = Instantiate(teamMateButtonPrefab); tmButton.transform.SetParent(teamMateButtonParent, false); tmButton.teamMate = gameController.TeamMates[t]; tmButton.faceReferences = TeammateFacesList[t]; tmButton.InitButton(t); teamMateButtons.Add(tmButton); int index = t; //Need to manually seperate the index tmButton.uiButton.onClick.AddListener(delegate { OnTeamMateButtonPressed(index); }); } WinScreen.SetActive(false); LoseScreen.SetActive(false); }