/// <summary> /// Refreshes the skill detailed menu about the last selected skill /// </summary> /// <param name="skillToCareAbout">The last selected skill</param> private void RefreshSkillDetails() { if (_lastSkill != null) { Skill skillToCareAbout = _lastSkill; // Set the display information to go with the skill _skillIcon.sprite = SkillHolder.GetSkillImage(skillToCareAbout.GetSkillNum()); _skillNameText.text = " " + SkillHolder.GetSkillName(skillToCareAbout.GetSkillNum()); _skillDescription.text = SkillHolder.GetSkillDescription(skillToCareAbout.GetSkillNum()); _damageText.text = skillToCareAbout.GetDamage().ToString(); _rangeText.text = skillToCareAbout.GetRange().ToString(); _cooldownText.text = skillToCareAbout.GetCoolDown().ToString(); } }
/// <summary> /// Display the preview menu with the ally's special skill /// </summary> /// <param name="allyStats">Reference to the ally who is parent of the skill</param> public void DisplayUpdatePreviewMenu(AllyStats allyStats) { // Update the skill preview string skillName = " None"; string skillDescription = "Upgrade magic to gain a skill"; string skillDmg = "0"; string skillRange = "0"; string skillCooldown = "0"; Sprite skillIcon = null; // Get the reference to the skill if (allyStats != null) { AllySkillController skillContRef = allyStats.GetComponent <AllySkillController>(); if (skillContRef != null) { Skill activeSkill = skillContRef.SpecialSkill; if (activeSkill != null) { skillName = " " + SkillHolder.GetSkillName(activeSkill.GetSkillNum()); skillDescription = SkillHolder.GetSkillDescription(activeSkill.GetSkillNum()); skillDmg = activeSkill.GetDamage().ToString(); skillRange = activeSkill.GetRange().ToString(); skillCooldown = activeSkill.GetCoolDown().ToString(); skillIcon = SkillHolder.GetSkillImage(activeSkill.GetSkillNum()); } } } // Set the values _skillNameText.text = skillName; _skillDescriptionText.text = skillDescription; _skillDmgText.text = skillDmg; _skillRangeText.text = skillRange; _skillCooldownText.text = skillCooldown; _skillIconImage.sprite = skillIcon; if (skillIcon == null) { _skillIconImage.color = new Color(0, 0, 0, 0); } else { _skillIconImage.color = new Color(1, 1, 1, 1); } // Set their colors to default _skillNameText.color = _defSkillTextCol; _skillDescriptionText.color = _defSkillTextCol; _skillDmgText.color = _defSkillTextCol; _skillRangeText.color = _defSkillTextCol; _skillCooldownText.color = _defSkillTextCol; }
/// <summary> /// Changes the skill detailed menu about the skill /// </summary> /// <param name="skillIndex">Index of the button pressed</param> public void ChangeSkillDetails(int skillIndex) { // Get the current character's available skills MoveAttack charMA = _mAGUIContRef.RecentCharSelectedMA; List <Skill> availSkills = charMA.GetComponent <CharacterSkills>().GetAvailableSkills(); // Get the skill coresponding to the clicked button Skill skillToCareAbout = availSkills[skillIndex]; // Set the display information to go with the skill _skillIcon.sprite = SkillHolder.GetSkillImage(skillToCareAbout.GetSkillNum()); _skillNameText.text = " " + SkillHolder.GetSkillName(skillToCareAbout.GetSkillNum()); _skillDescription.text = SkillHolder.GetSkillDescription(skillToCareAbout.GetSkillNum()); _damageText.text = skillToCareAbout.GetDamage().ToString(); _rangeText.text = skillToCareAbout.GetRange().ToString(); _cooldownText.text = skillToCareAbout.GetCoolDown().ToString(); _lastSkill = skillToCareAbout; }
/// <summary> /// Replaces text and such with what would happen if the skill was upgraded /// </summary> /// <param name="allyGrim">Grimoire of the selected</param> /// <param name="previewMagicStat">The amount the magic will potentially increase</param> public void PreviewSkillUpgrade(AllyGrimoire allyGrim, int amountIncrease) { // Default values string skillName = " None"; string skillDescription = "Upgrade magic to gain a skill"; int skillDmg = 0; int skillRange = 0; int skillCooldown = 0; Sprite skillIcon = null; // For if the values were changed at all bool isSkillNameBuff = false; bool isSkillDmgBuff = false; bool isSkillRangeBuff = false; bool isSkillCooldownBuff = false; // Get the starting values for the skill AllySkillController skillContRef = allyGrim.GetComponent <AllySkillController>(); if (skillContRef != null) { Skill activeSkill = skillContRef.SpecialSkill; if (activeSkill != null) { skillName = " " + SkillHolder.GetSkillName(activeSkill.GetSkillNum()); skillDescription = SkillHolder.GetSkillDescription(activeSkill.GetSkillNum()); skillIcon = SkillHolder.GetSkillImage(activeSkill.GetSkillNum()); skillDmg = activeSkill.GetDamage(); skillRange = activeSkill.GetRange(); skillCooldown = activeSkill.GetCoolDown(); } // Iterate over the buffs for (int i = 1; i <= amountIncrease; ++i) { // Get the next buff MagicBuff nextBuff = allyGrim.PeekForward(i); switch (nextBuff) { // If the next buff is to acquire a skill, get that skill and set the defaults case (MagicBuff.SKILLACQ): // We are going to temporarily give this character the skill in question to get the starting values Skill gainSkill = _skillHolderRef.GiveSkill(skillContRef, allyGrim.SkillToGain); skillName = " " + SkillHolder.GetSkillName(allyGrim.SkillToGain); skillDescription = SkillHolder.GetSkillDescription(allyGrim.SkillToGain); skillIcon = SkillHolder.GetSkillImage(allyGrim.SkillToGain); skillDmg = gainSkill.GetDamage(); skillRange = gainSkill.GetRange(); skillCooldown = gainSkill.GetCoolDown(); isSkillNameBuff = true; isSkillDmgBuff = true; isSkillRangeBuff = true; isSkillCooldownBuff = true; // Get rid of the temporary skill Destroy(gainSkill); break; // If the next buff is just an increment, increment them case (MagicBuff.DMGINC): ++skillDmg; isSkillDmgBuff = true; break; case (MagicBuff.RANGEINC): isSkillRangeBuff = true; ++skillRange; break; case (MagicBuff.COOLLWR): isSkillCooldownBuff = true; --skillCooldown; break; default: Debug.Log("Unhandled MagicBuff in SkillPreviewController"); break; } } // Set the values _skillNameText.text = skillName; _skillDescriptionText.text = skillDescription; _skillIconImage.sprite = skillIcon; if (skillIcon == null) { _skillIconImage.color = new Color(0, 0, 0, 0); } else { _skillIconImage.color = new Color(1, 1, 1, 1); } _skillDmgText.text = skillDmg.ToString(); _skillRangeText.text = skillRange.ToString(); _skillCooldownText.text = skillCooldown.ToString(); // Set the ones that were buffed to green if (isSkillNameBuff) { _skillNameText.color = CharDetailedMenuController.UpgradeTextCol; } if (isSkillDmgBuff) { _skillDmgText.color = CharDetailedMenuController.UpgradeTextCol; } if (isSkillRangeBuff) { _skillRangeText.color = CharDetailedMenuController.UpgradeTextCol; } if (isSkillCooldownBuff) { _skillCooldownText.color = CharDetailedMenuController.UpgradeTextCol; } } }
// Use this for initialization void Start() { defense = GetComponent<Defense>(); multiShot = gameObject.AddComponent<MultiShot>(); Debug.Log("MultiShot starting cooldown!" + multiShot.GetCoolDown()); }