using KTGMGemClient;
using TowerDefense.Towers;
using UnityEngine;
using UnityEngine.UI;
namespace TowerDefense.UI.HUD
{
///
/// Used to display infomation about a tower using Unity UI
///
public class TowerInfoDisplay : MonoBehaviour
{
///
/// The text component for the name
///
public Text towerName;
///
/// The text component for the description
///
public Text description;
///
/// The text component for the description
///
public Text dps;
///
/// The text component for the level
///
public Text level;
///
/// The text component for the health
///
public Text health;
///
/// The text component for the dimensions
///
public Text dimensions;
///
/// The text component for the dimensions
///
public Text upgradeCost;
///
/// The text component for the dimensions
///
public Text sellPrice;
///
/// Draws the tower data on to the canvas, if the relevant text components are populated
///
///
/// The tower to gain info from
///
public void Show(Tower tower)
{
int levelOfTower = tower.currentLevel;
Show(tower, levelOfTower);
}
///
/// Draws the tower data on to the canvas, if the relevant text components are populated
///
/// The tower to gain info from
/// The level of the tower
public void Show(Tower tower, int levelOfTower)
{
if (levelOfTower >= ElfUpgradeData.MaxTowerLevel)
{
return;
}
TowerLevel towerLevel = tower.CurrentTowerLevel;
DisplayText(towerName, tower.towerName);
DisplayText(level, (levelOfTower + 1).ToString());
DisplayText(dimensions, string.Format("{0}, {1}", tower.dimensions.x, tower.dimensions.y));
}
///
/// Draws the text if the text component is populated
///
///
///
static void DisplayText(Text textBox, string text)
{
if (textBox != null)
{
textBox.text = text;
}
}
}
}