Merge branch 'develop' into dhain
# Conflicts: # Assets/Scenes/MainScene.unity # Assets/Scripts/TileBehaviour.cs
This commit is contained in:
commit
38efeb6af6
191 changed files with 1070 additions and 751 deletions
|
|
@ -1,9 +1,19 @@
|
|||
using System;
|
||||
using DefaultNamespace;
|
||||
using Tiles;
|
||||
using UnityEngine;
|
||||
|
||||
public class TileBehaviour : MonoBehaviour {
|
||||
private BaseTile _tile;
|
||||
|
||||
public BaseTile Tile {
|
||||
get => _tile;
|
||||
set {
|
||||
_tile = value;
|
||||
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
||||
}
|
||||
}
|
||||
|
||||
private SpriteRenderer _hoverIndicatorSpriteRenderer;
|
||||
private static Color _hoverIndicatorColor;
|
||||
|
||||
|
|
@ -11,9 +21,15 @@ public class TileBehaviour : MonoBehaviour {
|
|||
void Start() {
|
||||
_hoverIndicatorSpriteRenderer = gameObject.transform.GetChild(2).GetComponent<SpriteRenderer>();
|
||||
SetHoverIndicatorVisibility(false);
|
||||
SetTile(new GrassTile(gameObject));
|
||||
Tile = new GrassTile();
|
||||
gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.clear;
|
||||
_hoverIndicatorColor = new Color(1, 1, 1, 0.3f);
|
||||
|
||||
HouseController.NewDayEvent.AddListener(DayLightStep);
|
||||
}
|
||||
|
||||
private void DayLightStep() {
|
||||
ActionInvoker.InvokeDayLightStep(gameObject);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
@ -21,23 +37,10 @@ public class TileBehaviour : MonoBehaviour {
|
|||
}
|
||||
|
||||
void OnMouseDown() {
|
||||
UsableItem usable = null;
|
||||
BaseTile tileToSetTo = null;
|
||||
|
||||
if(PlayerController.instance.GetSelectedItem() != null) {
|
||||
usable = PlayerController.instance.GetSelectedItem();
|
||||
UsableItem usableItem = PlayerController.instance.GetSelectedItem();
|
||||
if(usableItem != null) {
|
||||
ActionInvoker.InvokeAction(gameObject, usableItem);
|
||||
}
|
||||
|
||||
tileToSetTo = _tile.Clicked(usable);
|
||||
|
||||
if(tileToSetTo != null) {
|
||||
SetTile(tileToSetTo);
|
||||
}
|
||||
}
|
||||
|
||||
void SetTile(BaseTile tileToSet) {
|
||||
_tile = tileToSet;
|
||||
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
||||
}
|
||||
|
||||
private void OnMouseEnter() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue