fixed building outline bug
This commit is contained in:
parent
61fcd9bf82
commit
74727857ca
@ -40,17 +40,6 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
|
||||
{
|
||||
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()
|
||||
@ -106,6 +95,17 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
|
||||
_unitGameObject = parentGameObject;
|
||||
_canvas = canvas;
|
||||
_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)
|
||||
{
|
||||
@ -133,7 +133,11 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
HideTooltip();
|
||||
_outline.SetActive(false);
|
||||
|
||||
if (_outline)
|
||||
{
|
||||
_outline.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void HideTooltip()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user