public void UpdateDisplay(AllyInfo selectedAlly) { var threadDamageBonus = selectedAlly.capacity.Where(thread => thread.GetComponent <Ethread>().effectName == "RedThread").Count(); var threadMoveBonus = selectedAlly.capacity.Where(thread => thread.GetComponent <Ethread>().effectName == "BlueThread").Count(); nameText.text = selectedAlly.entity.entityName; subnameText.text = selectedAlly.entity.entitySubname; SetChips(damageChips, selectedAlly.entity.damage + threadDamageBonus); SetChips(moveRangeChips, selectedAlly.entity.maxMoves + threadMoveBonus); SetChips(atkRangeChips, selectedAlly.entity.range); var skills = SkillUtils.PopulateSkills(selectedAlly.entity.skillNames, new List <int> { 1, 1, 1 }); skillNameTexts = skillElements.Select(element => { return(element.Find("SkillName").GetComponent <Text>()); }).ToList(); skillDescTexts = skillElements.Select(element => { return(element.Find("SkillDesc").GetComponent <Text>()); }).ToList(); skills.ForEach(skill => { var skillNameText = skillNameTexts[0]; skillNameTexts.Remove(skillNameText); skillNameText.text = skill.name ?? ""; var skillDescText = skillDescTexts[0]; skillDescTexts.Remove(skillDescText); skillDescText.text = skill.desc ?? ""; }); var enablePrimarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "PurpleThread"); var enableSecondarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "YellowThread"); var enableTertiarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "PinkThread"); ToggleSkillText(skillElements[0], enablePrimarySkillText); ToggleSkillText(skillElements[1], enableSecondarySkillText); ToggleSkillText(skillElements[2], enableTertiarySkillText); // resets any skill section that was previously populated, that the newly selected ally does not have // i.e swapping from ally with 3 skills to one with 2 will empty the third slot even though skillNameTexts.ForEach(text => text.text = ""); skillDescTexts.ForEach(text => text.text = ""); }
void Start() { equippedThreads.ForEach(thread => thread.effect.ApplyEffect(this)); currentMoves = maxMoves; currentAttacks = maxAttacks; currentHP = maxHP; damageReceiver = this; currentSkillUses = maxSkillUses; currentSP = maxSP; if (isHostile) { enemyConfig = enemyConfigName.ToEnemyConfig(); } skills = SkillUtils.PopulateSkills(skillNames, skillLevels); behaviors = behaviorNames.ToBehaviors(this); fears = fearNames.ToFears(); afraidBehaviors = afraidBehaviorNames.ToBehaviors(this); healthBar = GenerateHealthBar(); UpdateHealthBar(); fearIcon = gameObject.transform.Find("FearIcon").gameObject; fearIcon.SetActive(false); turnAnimSequence = DOTween.Sequence(); }