added HoverIndicator (geht ned ganz)
This commit is contained in:
parent
7ccf683005
commit
74941ea9ae
3 changed files with 107 additions and 3 deletions
|
|
@ -1,13 +1,17 @@
|
|||
using System;
|
||||
using Tiles;
|
||||
using UnityEngine;
|
||||
|
||||
public class TileBehaviour : MonoBehaviour
|
||||
{
|
||||
private BaseTile _tile;
|
||||
private SpriteRenderer _hoverIndicatorSpriteRenderer;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
_hoverIndicatorSpriteRenderer = gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
||||
SetHoverIndicatorVisibility(false);
|
||||
SetTile(new GrassTile());
|
||||
|
||||
HouseController.NewDayEvent.AddListener(_tile.DayLightStep);
|
||||
|
|
@ -40,7 +44,23 @@ public class TileBehaviour : MonoBehaviour
|
|||
void SetTile(BaseTile tileToSet)
|
||||
{
|
||||
_tile = tileToSet;
|
||||
Debug.Log(_tile.Sprite);
|
||||
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
||||
}
|
||||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
Debug.Log("rein");
|
||||
SetHoverIndicatorVisibility(true);
|
||||
}
|
||||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
Debug.Log("raus");
|
||||
SetHoverIndicatorVisibility(false);
|
||||
}
|
||||
|
||||
private void SetHoverIndicatorVisibility(bool visible)
|
||||
{
|
||||
_hoverIndicatorSpriteRenderer.enabled = visible;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue