public void Init() { var active = PF_PlayerData.activeCharacter; if (active != null) { HP_Stat.statValue.text = "" + active.characterData.Health; HP_Stat.levelBonus.text = "+" + active.baseClass.HPLevelBonus; DP_Stat.statValue.text = "" + active.characterData.Defense; DP_Stat.levelBonus.text = "+" + active.baseClass.DPLevelBonus; SP_Stat.statValue.text = "" + active.characterData.Speed; SP_Stat.levelBonus.text = "+" + active.baseClass.SPLevelBonus; } if (PF_PlayerData.activeCharacter != null) { // test spell 1 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell1)) { UB_SpellDetail spell1 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell1]; this.Spell1.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell1, spell1, PF_PlayerData.activeCharacter.characterData.Spell1_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 1"); } // test spell 2 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell2)) { UB_SpellDetail spell2 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell2]; this.Spell2.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell2, spell2, PF_PlayerData.activeCharacter.characterData.Spell2_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 2"); } // test spell 3 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell3)) { UB_SpellDetail spell3 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell3]; this.Spell3.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell3, spell3, PF_PlayerData.activeCharacter.characterData.Spell3_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 3"); } } }
//copy ctor public EnemySpellDetail(EnemySpellDetail prius) { if (prius == null) { return; } SpellName = prius.SpellName; SpellPriority = prius.SpellPriority; SpellLevel = prius.SpellLevel; IsOnCooldown = prius.IsOnCooldown; CdTurns = prius.CdTurns; Detail = new UB_SpellDetail(prius.Detail); }
UB_SpellDetail UpgradeSpell(UB_SpellDetail sp, int level) { for (int z = 0; z < level; z++) { sp.BaseDmg *= Mathf.CeilToInt(1.0f + sp.UpgradePower); if (sp.ApplyStatus != null) { sp.ApplyStatus.ChanceToApply *= 1.0f + sp.UpgradePower; sp.ApplyStatus.ModifyAmount *= 1.0f + sp.UpgradePower; } } return(sp); }
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); }
//copy ctor public UB_SpellDetail(UB_SpellDetail prius) { if (prius == null) { return; } Description = prius.Description; Icon = prius.Icon; Target = prius.Target; BaseDmg = prius.BaseDmg; ManaCost = prius.ManaCost; BaseDmg = prius.BaseDmg; UpgradePower = prius.UpgradePower; UpgradeLevels = prius.UpgradeLevels; FX = prius.FX; Cooldown = prius.Cooldown; LevelReq = prius.LevelReq; ApplyStatus = new UB_SpellStatus(prius.ApplyStatus); }
public void Init() { if (PF_PlayerData.activeCharacter != null) { // test spell 1 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell1)) { UB_SpellDetail spell1 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell1]; this.Spell1.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell1, spell1, PF_PlayerData.activeCharacter.characterData.Spell1_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 1"); } // test spell 2 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell2)) { UB_SpellDetail spell2 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell2]; this.Spell2.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell2, spell2, PF_PlayerData.activeCharacter.characterData.Spell2_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 2"); } // test spell 3 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell3)) { UB_SpellDetail spell3 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell3]; this.Spell3.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell3, spell3, PF_PlayerData.activeCharacter.characterData.Spell3_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 3"); } } }
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"; }
public void Init() { // may want these things in an init function that can be called after certain calls complete if (PF_PlayerData.activeCharacter != null) { this.characterName.text = PF_PlayerData.activeCharacter.characterDetails.CharacterName; this.characterLevel.text = "" + PF_PlayerData.activeCharacter.characterData.CharacterLevel; this.hp.text = "" + PF_PlayerData.activeCharacter.PlayerVitals.MaxHealth; this.dp.text = "" + PF_PlayerData.activeCharacter.PlayerVitals.MaxDefense; this.sp.text = "" + PF_PlayerData.activeCharacter.PlayerVitals.MaxSpeed; Sprite icon = PF_PlayerData.activeCharacter.characterData.CustomAvatar == null?GameController.Instance.iconManager.GetIconById(PF_PlayerData.activeCharacter.baseClass.Icon) : GameController.Instance.iconManager.GetIconById(PF_PlayerData.activeCharacter.characterData.CustomAvatar); this.displayImage.overrideSprite = icon; if (PF_GameData.CharacterLevelRamp.Count > 0) { string key = string.Format("{0}", PF_PlayerData.activeCharacter.characterData.CharacterLevel + 1); if (PF_GameData.CharacterLevelRamp.ContainsKey(key)) { this.expBar.maxValue = PF_GameData.CharacterLevelRamp[key]; } this.expBar.currentValue = PF_PlayerData.activeCharacter.characterData.ExpThisLevel; } if (PF_PlayerData.characterVirtualCurrency.Count > 0) { if (PF_PlayerData.characterVirtualCurrency.ContainsKey(GlobalStrings.HEART_CURRENCY)) { this.livesCount.text = "" + PF_PlayerData.characterVirtualCurrency[GlobalStrings.HEART_CURRENCY]; /* if(PF_PlayerData.characterVirtualCurrency[GlobalStrings.HEART_CURRENCY] < 3) * { * TweenScale.Tween(this.heartArt.gameObject, .333f, new Vector3(1,1,1), new Vector3(1.1f,1.1f,1.1f), TweenMain.Style.PingPong, TweenMain.Method.EaseIn, null); * } * else * { * TweenScale.Tween(this.heartArt.gameObject, .5f, new Vector3(1,1,1), new Vector3(1.05f,1.05f,1.05f), TweenMain.Style.PingPong, TweenMain.Method.EaseIn, null); * }*/ } } } if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell1)) { UB_SpellDetail spell1 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell1]; this.spell1.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell1, spell1, PF_PlayerData.activeCharacter.characterData.Spell1_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 1"); } // test spell 2 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell2)) { UB_SpellDetail spell2 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell2]; this.spell2.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell2, spell2, PF_PlayerData.activeCharacter.characterData.Spell2_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 2"); } // test spell 3 if (PF_GameData.Spells.ContainsKey(PF_PlayerData.activeCharacter.baseClass.Spell3)) { UB_SpellDetail spell3 = PF_GameData.Spells[PF_PlayerData.activeCharacter.baseClass.Spell3]; this.spell3.LoadSpell(PF_PlayerData.activeCharacter.baseClass.Spell3, spell3, PF_PlayerData.activeCharacter.characterData.Spell3_Level); } else { // something went wrong, could not find the spell Debug.Log("something went wrong, could not find spell 3"); } }