unity-atoms/Packages/Core/Runtime/References/AtomBaseReference.cs

43 lines
1.2 KiB
C#
Raw Normal View History

using System;
2020-03-09 00:16:40 +01:00
using UnityEngine;
namespace UnityAtoms
{
2020-03-21 22:45:39 +01:00
/// <summary>
/// Different Reference usages.
/// </summary>
2020-03-09 00:16:40 +01:00
public class AtomReferenceUsage
{
public const int VALUE = 0;
public const int CONSTANT = 1;
public const int VARIABLE = 2;
public const int VARIABLE_INSTANCER = 3;
public static string DisplayName(int value)
{
switch (value)
{
case (VALUE): return "Value";
case (CONSTANT): return "Constant";
case (VARIABLE): return "Variable";
case (VARIABLE_INSTANCER): return "Variable Instancer";
default:
throw new Exception($"Value '{value}' is not valid! Valid values are: 0, 1, 2 or 3. ");
}
}
2020-03-09 00:16:40 +01:00
}
/// <summary>
/// None generic base class for `AtomReference&lt;T, C, V, E1, E2, F, VI&gt;`.
/// </summary>
public abstract class AtomBaseReference
{
2020-03-16 23:26:23 +01:00
public int Usage { get => _usage; set => _usage = value; }
2020-03-09 00:16:40 +01:00
/// <summary>
/// Describes how we use the Reference and where the value comes from.
/// </summary>
[SerializeField]
protected int _usage;
}
}