public void PopulateAsSpell(Player player, Spell spell) { if (spell == null) { Debug.LogWarning("empty spell trying to be populated"); return; } //calculate hypothetical stats for tooltip... I know... I know... but at least it should show the TRUE values, which is awesome spellHit spellHit = new spellHit(null, player, spell); spell.CalcCastFlatOffensive(spellHit); spell.CalcCastPerOffensive(spellHit); player.CalcCastFlatOffensive(spellHit); player.CalcCastPerOffensive(spellHit); texts[0].text = spell.name; texts[1].text = "range: " + spellHit.range; if (spellHit.castTime > 0) { texts[2].text = spellHit.castTime + " sec cast"; } else { texts[2].text = "instant cast"; } texts[3].text = spell.description; Canvas.ForceUpdateCanvases(); //cause texts to be updated, giving us a readable cache //scale the background to description height ResetScale(transform.GetChild(0).GetComponent <RectTransform>()); AddScale(transform.GetChild(0).GetComponent <RectTransform>(), texts[3].cachedTextGenerator.lines.Count); }
public void Set(spellHit _spellHit, float _speed) { spellHit = _spellHit; speed = _speed; }