diff --git a/Assets/Scripts/Ally/Tooltip/TooltipManager.cs b/Assets/Scripts/Ally/Tooltip/TooltipManager.cs index 46b939c..babeb1c 100644 --- a/Assets/Scripts/Ally/Tooltip/TooltipManager.cs +++ b/Assets/Scripts/Ally/Tooltip/TooltipManager.cs @@ -1,5 +1,6 @@ using GatherAndDefend.Events; using System; +using System.Diagnostics; public class TooltipManager : Singleton { @@ -14,12 +15,18 @@ public class TooltipManager : Singleton private bool _tooltipVisibility; public bool TooltipVisibility { get { return _tooltipVisibility; } } - public void ShowTooltip(UnitCard unitCard, string hp, string dmg, string atkSpeed) + public void ShowTooltip(UnitCard unitCard, string hp, string dmg, string atkSpeed, bool isNotTile = true) { string description = DescriptionManager(unitCard); _tooltipVisibility = true; _description = description; - _hp = hp; + if (hp.Equals("0") && isNotTile) + { + _hp = "1"; + } else + { + _hp = hp; + } _damage = dmg; _attackSpeed = atkSpeed; EventAggregator.Instance.GetEvent().Invoke(); @@ -33,15 +40,19 @@ public class TooltipManager : Singleton private string DescriptionManager(UnitCard unitCard) { - string tooltipDescription; - if (unitCard?.TooltipString.Length > 0) + if (unitCard) { - tooltipDescription = unitCard.TooltipString; + string tooltipDescription; + if (unitCard?.TooltipString.Length > 0) + { + tooltipDescription = unitCard.TooltipString; + } + else + { + tooltipDescription = "Exemple de description d'unité pour " + unitCard.name.ToLower(); + } + return tooltipDescription; } - else - { - tooltipDescription = "Exemple de description d'unité pour " + unitCard.name.ToLower(); - } - return tooltipDescription; + return null; } } diff --git a/Assets/Scripts/Ally/Tooltip/TooltipText.cs b/Assets/Scripts/Ally/Tooltip/TooltipText.cs index af11718..a4dc41b 100644 --- a/Assets/Scripts/Ally/Tooltip/TooltipText.cs +++ b/Assets/Scripts/Ally/Tooltip/TooltipText.cs @@ -30,7 +30,7 @@ public class TooltipText : MonoBehaviour { _tooltipPanel.SetActive(true); _tooltipDescription.text = _tooltipManager.Description; - _tooltipHp.text = (_tooltipManager.Hp.Equals("0") ? "Ne peut pas être attaqué" : "Points de vie: " + _tooltipManager.Hp); + _tooltipHp.text = (_tooltipManager.Hp.Equals("0") ? ("Intouchable") : "Points de vie: " + _tooltipManager.Hp); _tooltipDmg.text = (_tooltipManager.Damage.Equals("0") ? "Ne peut pas attaquer" : "Dommage: " + _tooltipManager.Damage); _tooltipAttackSpeed.text = (_tooltipManager.Damage.Equals("0") ? EMPTY_STRING : "Vitesse d'attaque: " + _tooltipManager.AttackSpeed); } diff --git a/Assets/Scripts/Drag&Drop/GameObjectPlacementButton.cs b/Assets/Scripts/Drag&Drop/GameObjectPlacementButton.cs index ee12ca9..d75de55 100644 --- a/Assets/Scripts/Drag&Drop/GameObjectPlacementButton.cs +++ b/Assets/Scripts/Drag&Drop/GameObjectPlacementButton.cs @@ -86,7 +86,6 @@ public class GameObjectPlacementButton : UnitPlacementButton public override void OnPointerEnter(PointerEventData eventData) { Ally allyObj = _prefab.GetComponent(); - Debug.Log("For " + _unitCardInformation.name + ": " + allyObj.Hp); TooltipManager.Instance.ShowTooltip(_unitCardInformation, allyObj.Hp.ToString(), allyObj.AttackDamage.ToString(), allyObj.AttackInterval.ToString()); } diff --git a/Assets/Scripts/Drag&Drop/TilePlacementButton.cs b/Assets/Scripts/Drag&Drop/TilePlacementButton.cs index 52dea94..aae2d1e 100644 --- a/Assets/Scripts/Drag&Drop/TilePlacementButton.cs +++ b/Assets/Scripts/Drag&Drop/TilePlacementButton.cs @@ -26,7 +26,7 @@ public class TilePlacementButton : UnitPlacementButton public override void OnPointerEnter(PointerEventData eventData) { - TooltipManager.Instance.ShowTooltip(_unitCardInformation, NULL, NULL, NULL); + TooltipManager.Instance.ShowTooltip(_unitCardInformation, NULL, NULL, NULL, false); } public override void OnPointerExit(PointerEventData eventData)