37 lines
940 B
C#
37 lines
940 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace RebootKit.Engine.Foundation {
|
|
[Serializable]
|
|
public struct ConstsProperty<T> {
|
|
[SerializeField] T m_InlineValue;
|
|
[SerializeField] ConstantsAsset<T> m_Asset;
|
|
[SerializeField] bool m_UseInlineValue;
|
|
|
|
public ConstsProperty(T value) {
|
|
m_InlineValue = value;
|
|
m_Asset = null;
|
|
m_UseInlineValue = true;
|
|
}
|
|
|
|
public ConstsProperty(ConstantsAsset<T> asset) {
|
|
m_InlineValue = default;
|
|
m_Asset = asset;
|
|
m_UseInlineValue = false;
|
|
}
|
|
|
|
public T Value {
|
|
get {
|
|
if (m_UseInlineValue) {
|
|
return m_InlineValue;
|
|
}
|
|
|
|
if (m_Asset != null) {
|
|
return m_Asset.Value;
|
|
}
|
|
|
|
return default;
|
|
}
|
|
}
|
|
}
|
|
} |