// Fill the Upgrade Panel UI with the Upgrade Unit stats
 private void PopulateWithUpgradeUnitStats()
 {
     upgradeDefenderPreview.sprite = upgradeUnit.GetComponentInChildren <SpriteRenderer>().sprite;
     unitName.text    = upgradeUnit.GetUnitName();
     unitCost.text    = upgradeUnit.GetUnitPrice().ToString();
     unitHealth.text  = "Health: " + upgradeUnit.GetUnitHealth().ToString();
     unitDamage.text  = "Damage: " + upgradeUnit.GetUnitDamage().ToString();
     unitAbility.text = "Ability: " + upgradeUnit.GetAbilityDescription();
 }
Esempio n. 2
0
 /// <summary>
 /// Return the selected Defender's price in Stars
 /// </summary>
 /// <returns>Defender price</returns>
 public int GetSelectedDefenderPrice()
 {
     return(selectedDefender.GetComponentInChildren <Defender>().StarCost);
 }
 // Destroy the current selected unit
 private void RemoveCurrentSelectedDefender()
 {
     currentSelectedDefender.SetSelected(false);
     currentSelectedDefender.GetComponentInChildren <SelectedUnitIndicator>().RemoveSelectedIndicator();
     Destroy(currentSelectedDefender.gameObject);
 }
    void SetSortingOrderByRowNumber(Defender defenderObject, Vector2 position)
    {
        var numRows = transform.localScale.y;

        defenderObject.GetComponentInChildren <SpriteRenderer>().sortingOrder = Mathf.RoundToInt(numRows) - Mathf.RoundToInt(position.y);
    }