evershade/Assets/Data/ScriptableObjects/World/Interactable.cs

99 lines
1.9 KiB
C#

using System;
using UnityEngine;
public enum InteractableType
{
Crop,
Tree,
Rock,
Box,
Door,
Npc,
Sign
}
public interface IInteractable
{
public string ObjectName { get; set; }
public int ID { get; set; }
public InteractableType Type { get; set; }
public void OnEnter2D(Collider2D collider);
public void OnExit2D(Collider2D collider);
public bool IsPlayerInInteractRange(Vector2 playerPosition, Vector2 itemPosition);
public bool IsToolRequired();
public void OnInteract();
public void OnDayChange();
}
public abstract class Interactable : ScriptableObject, IInteractable
{
public Sprite display;
public float interactRange;
public Vector2Int size;
public ToolItem.ToolType[] validToolTypes;
public int id;
public string objectName;
public InteractableType type;
public void Awake()
{
id = GetInstanceID();
objectName = GetType().Name;
type = InteractableType.Crop;
}
public string ObjectName
{
get => objectName;
set => objectName = value;
}
public int ID
{
get => id;
set => id = value;
}
public InteractableType Type
{
get => type;
set => type = value;
}
public void OnEnter2D(Collider2D collider)
{
Debug.Log("Interactable OnEnter2D");
}
public void OnExit2D(Collider2D collider)
{
throw new NotImplementedException();
}
public bool IsPlayerInInteractRange(Vector2 playerPosition, Vector2 itemPosition)
{
throw new NotImplementedException();
}
public bool IsToolRequired()
{
throw new NotImplementedException();
}
public void OnInteract()
{
throw new NotImplementedException();
}
public void OnDayChange()
{
throw new NotImplementedException();
}
}