using System;
using RPGCore.Core.Objects;
using UnityEngine;
namespace RPGCore.Core
{
///
/// Extend this abstract class to create new module for <> object type.
///
/// Type of object that this module will be attached to. Can be or any of its children.
[Serializable]
public abstract class ObjectModule : ObjectModule where T : BaseObject
{
public new T parent => (T)base.parent;
}
///
/// DO NOT EXTEND THIS, use instead!
///
[Serializable]
public abstract class ObjectModule : MonoBehaviour
{
private BaseObject _parent;
internal BaseObject parent
{
get
{
if (!_parent) _parent = GetComponent();
return _parent;
}
set => _parent = value;
}
private protected ObjectModule()
{
}
}
}