using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; [ExecuteInEditMode] public class Tile : MonoBehaviour { // Start is called before the first frame update public enum TileType : int {Dirt = 0, Grass = 1, Water = 2, Unwalkable = 3}; [SerializeField] private int currentType; public TileType myType; public int movementCost; public bool walkable; public GameObject myManager; public void Refresh(){ gameObject.GetComponent().material = myManager.GetComponent().tileTextures[currentType]; Debug.Log("printing"); } void Start() { this.runInEditMode = true; } // Update is called once per frame void Update() { State(); } void State(){ switch(myType){ case TileType.Dirt: movementCost = 1; walkable = true; currentType = (int) myType; break; case TileType.Grass: movementCost = 3; walkable = true; currentType = (int) myType; break; case TileType.Water: movementCost = 2; walkable = true; currentType = (int) myType; break; case TileType.Unwalkable: walkable = false; currentType = (int) myType; break; } } }