evershade/Assets/Data/ScriptableObjects/Tile.cs

52 lines
1.1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
public class Tile : ScriptableObject
{
public bool blockMovement;
public bool blockBuilding = true;
public bool blockInteractable;
public List<GameItem> GameItems { get; set; }
public Interactable Interactable { get; set; }
public void Initialize(Vector2Int vector2Int)
{
Debug.Log("GRID: GridSpace Initialize");
// Crop = null;
GameItems = new List<GameItem>();
Interactable = null;
}
public void AddGameItem(GameItem gameItem)
{
GameItems.Add(gameItem);
}
public void RemoveGameItem(GameItem gameItem)
{
GameItems.Remove(gameItem);
}
public void ClearGameItems()
{
GameItems.Clear();
}
public void ClearInteractableItem()
{
Interactable = null;
}
public bool IsBuildable()
{
// has no items or interactable on it
return GameItems.Count == 0 && Interactable == null && !blockBuilding;
}
public void SetInteractable(Interactable interactable)
{
Interactable = interactable;
}
}