Compare commits

..

No commits in common. "67cd2dd7c0cb759e8e8aba7f254b8755f309be72" and "9cd73b641cbb153f38b640c199a2b62b8486f298" have entirely different histories.

View File

@ -40,6 +40,17 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
{ {
Destroy(gameObject); Destroy(gameObject);
} }
if (!_outline && _unitGameObject.TryGetComponent(out House currentBuilding))
{
_outline = new GameObject("Outline");
var rend = _outline.AddComponent<SpriteRenderer>();
rend.sprite = _rangeSprite;
rend.sortingLayerName = "Character";
rend.sortingOrder = 1;
rend.color = new Color(1, 1, 1, 0.2f);
}
} }
void Update() void Update()
@ -95,17 +106,6 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
_unitGameObject = parentGameObject; _unitGameObject = parentGameObject;
_canvas = canvas; _canvas = canvas;
_unitArt.sprite = unitUpgrade.UpgradeCardArt; _unitArt.sprite = unitUpgrade.UpgradeCardArt;
if (_outline == null && _unitGameObject.TryGetComponent(out House currentBuilding))
{
_outline = new GameObject("Outline");
var rend = _outline.AddComponent<SpriteRenderer>();
rend.sprite = _rangeSprite;
rend.sortingLayerName = "Character";
rend.sortingOrder = 1;
rend.color = new Color(1, 1, 1, 0.2f);
}
} }
public void OnPointerEnter(PointerEventData eventData) public void OnPointerEnter(PointerEventData eventData)
{ {
@ -133,12 +133,8 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
public void OnPointerExit(PointerEventData eventData) public void OnPointerExit(PointerEventData eventData)
{ {
HideTooltip(); HideTooltip();
if (_outline)
{
_outline.SetActive(false); _outline.SetActive(false);
} }
}
private void HideTooltip() private void HideTooltip()
{ {