This commit is contained in:
2026-04-25 23:37:10 +02:00
commit 19d6bd934a
476 changed files with 9198 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
using System;
using RPGCore.Core.Objects;
using UnityEngine;
namespace RPGCore.Core
{
/// <summary>
/// Extend this abstract class to create new module for &lt;<typeparamref name="T"/>&gt; object type.<br/>
/// </summary>
/// <typeparam name="T">Type of object that this module will be attached to. Can be <see cref="BaseObject"/> or any of its children.</typeparam>
[Serializable]
public abstract class ObjectModule<T> : ObjectModule where T : BaseObject
{
public new T parent => (T)base.parent;
}
/// <summary>
/// <b>DO NOT EXTEND THIS</b>, use <see cref="ObjectModule{T}"/> instead!
/// </summary>
[Serializable]
public abstract class ObjectModule : MonoBehaviour
{
private BaseObject _parent;
internal BaseObject parent
{
get
{
if (!_parent) _parent = GetComponent<BaseObject>();
return _parent;
}
set => _parent = value;
}
private protected ObjectModule()
{
}
}
}