Crops working
This commit is contained in:
parent
22a4abf927
commit
7ceb7e4bcb
10 changed files with 388 additions and 117 deletions
|
|
@ -2,35 +2,46 @@ using System;
|
|||
using Tiles;
|
||||
using UnityEngine;
|
||||
|
||||
public class TileBehaviour : MonoBehaviour {
|
||||
public class TileBehaviour : MonoBehaviour
|
||||
{
|
||||
private BaseTile _tile;
|
||||
private SpriteRenderer _hoverIndicatorSpriteRenderer;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
void Start()
|
||||
{
|
||||
//_hoverIndicatorSpriteRenderer = gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
||||
//SetHoverIndicatorVisibility(false);
|
||||
SetTile(new GrassTile());
|
||||
|
||||
HouseController.NewDayEvent.AddListener(_tile.DayLightStep);
|
||||
SetTile(new GrassTile(gameObject));
|
||||
gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.clear;
|
||||
}
|
||||
|
||||
void OnMouseDown() {
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
UsableItem usable = null;
|
||||
BaseTile tileToSetTo = null;
|
||||
|
||||
if(PlayerController.instance.GetSelectedItem() != null) {
|
||||
if (PlayerController.instance.GetSelectedItem() != null)
|
||||
{
|
||||
usable = PlayerController.instance.GetSelectedItem();
|
||||
}
|
||||
|
||||
tileToSetTo = _tile.Clicked(usable);
|
||||
|
||||
if(tileToSetTo != null) {
|
||||
if (tileToSetTo != null)
|
||||
{
|
||||
SetTile(tileToSetTo);
|
||||
}
|
||||
}
|
||||
|
||||
void SetTile(BaseTile tileToSet) {
|
||||
void SetTile(BaseTile tileToSet)
|
||||
{
|
||||
_tile = tileToSet;
|
||||
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
||||
}
|
||||
|
|
@ -49,4 +60,4 @@ public class TileBehaviour : MonoBehaviour {
|
|||
{
|
||||
_hoverIndicatorSpriteRenderer.enabled = visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue