using System.Reflection;
using Facepunch.ActionGraphs;
namespace Sandbox
{
///
[AttributeUsage( AttributeTargets.Method )]
public sealed class PureAttribute : Attribute, IPureAttribute
{
}
///
[AttributeUsage( AttributeTargets.Method )]
public sealed class ImpureAttribute : Attribute, IImpureAttribute
{
}
///
[AttributeUsage( AttributeTargets.Parameter )]
public sealed class ActionGraphTargetAttribute : Attribute, ITargetAttribute
{
}
///
/// In ActionGraph, this type parameter can only be satisfied by a type TArg, such
/// that there exists at least one non-abstract type that extends / implements both
/// TArg and .
///
[AttributeUsage( AttributeTargets.GenericParameter, AllowMultiple = true )]
public sealed class HasImplementationAttribute : Attribute
{
///
/// Base class or interface for which there must exist an extending / implementing type.
///
public Type BaseType { get; }
///
///
/// Base class or interface for which there must exist an extending / implementing type.
///
public HasImplementationAttribute( Type baseType )
{
BaseType = baseType;
}
}
///
/// In ActionGraph, this parameter should only be configurable in the inspector as a property and not have a dedicated input.
///
[AttributeUsage( AttributeTargets.Parameter )]
public sealed class ActionGraphPropertyAttribute : Attribute, IPropertyAttribute
{
}
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Constructor )]
public sealed class ActionGraphIgnoreAttribute : Attribute
{
}
///
/// Don't cache instances of this type when serializing action graph references, force them to be always serialized separately.
/// We need this for component / game object references so we can update IDs when duplicating objects / instantiating prefabs.
///
[AttributeUsage( AttributeTargets.Struct | AttributeTargets.Class )]
public sealed class ActionGraphExposeWhenCachedAttribute : Attribute, IExposeWhenCachedAttribute
{
}
///
[AttributeUsage( AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor )]
public class ActionGraphNodeAttribute : Attribute, INodeAttribute
{
///
public string Identifier { get; }
///
public bool DefaultInputSignal { get; set; } = true;
///
public bool DefaultOutputSignal { get; set; } = true;
///
public bool InheritAsync { get; set; } = false;
public ActionGraphNodeAttribute( string identifier )
{
Identifier = identifier;
}
}
///
/// Display this node as an operator, with no header or socket labels, and a big icon in the middle.
///
[AttributeUsage( AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor )]
public sealed class ActionGraphOperatorAttribute : Attribute
{
}
[Obsolete( "Please use [ActionGraphNode( id ), Pure]." )]
[AttributeUsage( AttributeTargets.Method )]
public sealed class ExpressionNodeAttribute : NodeAttribute, IPureAttribute
{
public ExpressionNodeAttribute( string identifier )
: base( identifier )
{
}
}
[Obsolete( "Please use [ActionGraphNode( id )]." )]
[AttributeUsage( AttributeTargets.Method )]
public sealed class ActionNodeAttribute : NodeAttribute
{
public ActionNodeAttribute( string identifier )
: base( identifier )
{
}
}
[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Constructor )]
public sealed class ActionGraphIncludeAttribute : Attribute
{
///
/// If true, double-clicking on an output of the declaring type will auto-expand this member.
///
public bool AutoExpand { get; set; }
}
///
/// Force a delegate-type property to only have a single attached Action Graph.
///
[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )]
public sealed class SingleActionAttribute : Attribute
{
}
}