void UpdateUnitInfo() { //if (currTargetGroup.Count == 0) return; if (targets.Count != 0 && currTargetGroup.Count != 0 && currTargetGroup[0] != null) { Health selHealth = currTargetGroup[0].GetComponent <Health>(); //!!!!!kanske använda det indexet som spellselected har, dvs visa health för den som kastar spellen!!!!! if (selHealth.unitSprite != null) { unitPortrait.sprite = selHealth.unitSprite; } else { unitPortrait.sprite = null; } currHealthText.text = selHealth.GetCurrHealth().ToString(); maxHealthText.text = "/" + selHealth.maxHealth.ToString(); armorText.text = selHealth.armor.ToString(); hpRegText.text = selHealth.healthRegAmount.ToString(); armorTypeImage.sprite = damageHandler.GetArmorSprite(selHealth.armorType); if (currTargetGroup[0].GetComponent <AIBase>() != null) { AIBase selAIBase = currTargetGroup[0].GetComponent <AIBase>(); minDamageText.text = selAIBase.GetMinDamage().ToString(); maxDamageText.text = selAIBase.GetMaxDamage().ToString(); damageTypeImage.sprite = damageHandler.GetDamageSprite(selAIBase.damageType); } else { minDamageText.text = "N/A"; maxDamageText.text = "/" + "N/A"; damageTypeImage.sprite = damageHandler.GetDefaultSprite(); } UpdateSpellInfo(); } else { currHealthText.text = "N/A"; maxHealthText.text = " N/A"; armorTypeImage.sprite = damageHandler.GetDefaultSprite(); armorText.text = " N/A"; hpRegText.text = " N/A"; minDamageText.text = "N/A"; maxDamageText.text = "/" + "N/A"; damageTypeImage.sprite = damageHandler.GetDefaultSprite(); } }