Files
TheVVaS-Assets/RPGCoreCommon/DynamicValues/Runtime/DynamicValueAttribute.cs
T
2026-04-25 23:37:10 +02:00

32 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Object = UnityEngine.Object;
namespace RPGCoreCommon.DynamicValues
{
[AttributeUsage(AttributeTargets.Field)]
public class DynamicValueAttribute : PropertyAttribute
{
internal DynamicValueType type { private set; get; }
internal List<Type> staticTypes { private set; get; }
internal List<Type> ignoredDeclaringTypes { private set; get; } = new()
{
typeof(Object),
typeof(Behaviour),
typeof(MonoBehaviour),
typeof(Component)
};
/// <summary>
/// <see cref="DynamicValue"/> will be managed via code (adding/removing in inspector is)
/// </summary>
public DynamicValueAttribute(DynamicValueType type = DynamicValueType.BySerializedSources, params Type[] staticTypes)
{
this.type = type;
if (type is DynamicValueType.ByStaticTypes) this.staticTypes = staticTypes.ToList();
}
}
}