public void LoadSpell(string sName, UB_SpellDetail sp, int lvl) { this.baseSpell = sp; this.spell = new UB_Spell() { SpellName = sName, Description = sp.Description, Icon = sp.Icon, Dmg = sp.BaseDmg, Level = 0, UpgradeLevels = sp.UpgradeLevels, FX = sp.FX, Cooldown = sp.Cooldown, LevelReq = sp.LevelReq, ApplyStatus = sp.ApplyStatus }; this.SpellIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(sp.Icon); if (lvl > 0) { UpgradeSpell(lvl); } spellUpgradeBar.LoadBar(lvl, sp.UpgradeLevels); if (PF_PlayerData.activeCharacter.characterData.CharacterLevel < this.spell.LevelReq) { this.unlockedLevel.text = "Unlocked at level: " + this.spell.LevelReq; this.lockedIcon.gameObject.SetActive(true); this.lockedMessage.gameObject.SetActive(true); this.UpgradeButton.interactable = false; } else { this.lockedIcon.gameObject.SetActive(false); this.lockedMessage.gameObject.SetActive(false); this.UpgradeButton.interactable = true; } this.SpellName.text = this.spell.SpellName; this.Damage.text = "" + this.spell.Dmg; this.UpgradeDamage.text = "" + Mathf.CeilToInt((1f + this.baseSpell.UpgradePower) * (float)this.spell.Dmg); }
public void AddSpellData(string spName, UB_SpellDetail sp, int spLvl) { if (sp == null) { return; } this.baseSpell = sp; this.SpellData = new UB_Spell() { SpellName = spName, Description = sp.Description, Icon = sp.Icon, Dmg = sp.BaseDmg, Level = 0, UpgradeLevels = sp.UpgradeLevels, FX = sp.FX, Cooldown = sp.Cooldown, LevelReq = sp.LevelReq, ApplyStatus = sp.ApplyStatus }; this.SpellIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(sp.Icon); if (spLvl > 0) { UpgradeSpell(spLvl); } if (PF_PlayerData.activeCharacter.characterData.CharacterLevel < this.SpellData.LevelReq) { this.DisableCD(); this.Lock(); } else { this.Unlock(); this.DisableCD(); } }
// public void LoadSpell(UB_SavedCharacter saved) // { // // } // public void LoadSpell(string sName, UB_SpellDetail sp, int lvl) { this.baseSpell = sp; this.spell = new UB_Spell() { SpellName = sName, Description = sp.Description, Icon = sp.Icon, Dmg = sp.BaseDmg, Level = 0, UpgradeLevels = sp.UpgradeLevels, FX = sp.FX, Cooldown = sp.Cooldown, LevelReq = sp.LevelReq, ApplyStatus = sp.ApplyStatus }; this.spellIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(sp.Icon, IconManager.IconTypes.Spell); if (lvl > 0) { UpgradeSpell(lvl); } spellUpgradeBar.LoadBar(lvl, sp.UpgradeLevels); if (PF_PlayerData.activeCharacter.characterData.CharacterLevel < this.spell.LevelReq) { this.lockedIcon.gameObject.SetActive(true); this.lockedIcon.GetComponentInChildren <Text>().text = "Unlocks at " + this.spell.LevelReq; } else { this.lockedIcon.gameObject.SetActive(false); } this.spellName.text = this.spell.SpellName; this.damageValue.text = "+" + this.spell.Dmg + " DMG"; }