diff --git a/Assets/GrassTile.prefab b/Assets/BaseTile.prefab similarity index 99% rename from Assets/GrassTile.prefab rename to Assets/BaseTile.prefab index 67d2bc6..517481a 100644 --- a/Assets/GrassTile.prefab +++ b/Assets/BaseTile.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 4752245148499717903} - component: {fileID: 4752245148499717900} m_Layer: 0 - m_Name: GrassTile + m_Name: BaseTile m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scripts/GrassTile.cs b/Assets/Scripts/TileBehaviour.cs similarity index 53% rename from Assets/Scripts/GrassTile.cs rename to Assets/Scripts/TileBehaviour.cs index 292730d..5a16978 100644 --- a/Assets/Scripts/GrassTile.cs +++ b/Assets/Scripts/TileBehaviour.cs @@ -1,14 +1,18 @@ using System; using System.Collections; using System.Collections.Generic; +using Tiles; using UnityEngine; -public class GrassTile : MonoBehaviour +public class TileBehaviour : MonoBehaviour { + private BaseTile tile; + // Start is called before the first frame update void Start() { Debug.Log("Created"); + SetTile(new GrassTile()); } // Update is called once per frame @@ -20,5 +24,12 @@ public class GrassTile : MonoBehaviour void OnMouseDown() { Debug.Log("Clicked"); + tile.Clicked(/* Current tool */ null); + } + + void SetTile(BaseTile tileToSet) + { + tile = tileToSet; + GetComponent().color = tile.getColor; } } diff --git a/Assets/Scripts/TileController.cs b/Assets/Scripts/TileController.cs index 4827192..5049d4b 100644 --- a/Assets/Scripts/TileController.cs +++ b/Assets/Scripts/TileController.cs @@ -35,4 +35,6 @@ public class TileController : MonoBehaviour { } + + } diff --git a/Assets/Scripts/Tiles/BaseTile.cs b/Assets/Scripts/Tiles/BaseTile.cs new file mode 100644 index 0000000..47e2114 --- /dev/null +++ b/Assets/Scripts/Tiles/BaseTile.cs @@ -0,0 +1,42 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace Tiles +{ + public abstract class BaseTile + { + protected Color color; + public Color getColor => color; + // Later to be replaced with + // public Sprite sprite; + + protected BaseTile(Color color) + { + this.color = color; + } + + protected void Start() + { + + } + + protected void Update() + { + + } + + public void DayLightStep() + { + + } + + public void Clicked(UsableItem usable) + { + Debug.Log(usable.ToString() + " used on " + this.ToString()); + } + + + } +} \ No newline at end of file diff --git a/Assets/Scripts/Tiles/FarmlandTile.cs b/Assets/Scripts/Tiles/FarmlandTile.cs new file mode 100644 index 0000000..8304251 --- /dev/null +++ b/Assets/Scripts/Tiles/FarmlandTile.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace Tiles +{ + public class FarmlandTile : BaseTile + { + public FarmlandTile() : base(Color.black) + { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Tiles/GrassTile.cs b/Assets/Scripts/Tiles/GrassTile.cs new file mode 100644 index 0000000..0efeb0a --- /dev/null +++ b/Assets/Scripts/Tiles/GrassTile.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace Tiles +{ + public class GrassTile : BaseTile + { + public GrassTile() : base(Color.green) + { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Tiles/WaterTile.cs b/Assets/Scripts/Tiles/WaterTile.cs new file mode 100644 index 0000000..9542f0b --- /dev/null +++ b/Assets/Scripts/Tiles/WaterTile.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace Tiles +{ + public class WaterTile : BaseTile + { + public WaterTile() : base(Color.blue) + { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UsableItem.cs b/Assets/Scripts/UsableItem.cs index 60fa969..111ab64 100644 --- a/Assets/Scripts/UsableItem.cs +++ b/Assets/Scripts/UsableItem.cs @@ -16,10 +16,12 @@ public class UsableItem : Item, IUsable } - public UsableItem(string displayName, string description, int id) : base(displayName, description, id) { - } + public UsableItem(string displayName, string description, int id) : base(displayName, description, id) + { + } - public void select() { - PlayerController.getInstance().setSelectedItem(this); + public void select() + { + PlayerController.getInstance().setSelectedItem(this); + } } -}