added Tiles, basic TileBehaviour
This commit is contained in:
parent
66756be23b
commit
433158e658
8 changed files with 100 additions and 7 deletions
35
Assets/Scripts/TileBehaviour.cs
Normal file
35
Assets/Scripts/TileBehaviour.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Tiles;
|
||||
using UnityEngine;
|
||||
|
||||
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
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
Debug.Log("Clicked");
|
||||
tile.Clicked(/* Current tool */ null);
|
||||
}
|
||||
|
||||
void SetTile(BaseTile tileToSet)
|
||||
{
|
||||
tile = tileToSet;
|
||||
GetComponent<SpriteRenderer>().color = tile.getColor;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue