Craftelia 4711ae0230 design/afterGala3BalancePatch (#22)
- Massive rebalance of all units and levels (game is more focused on early base building and late powerful waves)
- Added all desert levels
- Added spearman, archer lvl3, gatherers lvl2 and lvl3, temp art skittering husk
- Added stone house (more pop)
- Tooltip visual rework
- Some bugs fixed
- Playing sounds when placing units

Reviewed-on: http://gitea.clubconjure.com/Conjure/gather-and-defend/pulls/22
Reviewed-by: Ader_Alisma <ader.alisma.1@ens.etsmtl.ca>
Co-authored-by: Craftelia <william-gin1@hotmail.com>
Co-committed-by: Craftelia <william-gin1@hotmail.com>
2026-01-24 15:50:46 +00:00

58 lines
1.7 KiB
C#

using System;
using UnityEngine;
using TMPro;
using GatherAndDefend.Events;
public class TooltipText : MonoBehaviour
{
private TooltipManager _tooltipManager;
[SerializeField]
private GameObject _tooltipPanel;
[SerializeField]
private TextMeshProUGUI _tooltipDescription;
[SerializeField]
private TextMeshProUGUI _tooltipHp;
[SerializeField]
private TextMeshProUGUI _tooltipDmg;
[SerializeField]
private TextMeshProUGUI _tooltipAttackSpeed;
private const string EMPTY_STRING = "";
private void Start()
{
_tooltipManager = TooltipManager.Instance;
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Attach(OnEventUpdate);
}
private void OnDestroy()
{
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Detach(OnEventUpdate);
}
private void OnEventUpdate()
{
if (_tooltipManager.TooltipVisibility)
{
_tooltipPanel.SetActive(true);
_tooltipDescription.text = _tooltipManager.Description;
_tooltipHp.text = (_tooltipManager.Hp.Equals("0") ? ("Intouchable")
: $"({_tooltipManager.Hp} hp) ({_tooltipManager.Damage} atk)");
float dmg = float.Parse(_tooltipManager.Damage);
float atkSpeed = float.Parse(_tooltipManager.AttackSpeed);
float dps = dmg / atkSpeed;
_tooltipDmg.text = (_tooltipManager.Damage.Equals("0")) ? ""
: $"{dps:0.00} dps";
}
else
{
_tooltipPanel.SetActive(false);
_tooltipDescription.text = EMPTY_STRING;
_tooltipHp.text = EMPTY_STRING;
_tooltipDmg.text = EMPTY_STRING;
_tooltipAttackSpeed.text = EMPTY_STRING;
}
}
}