summaryrefslogtreecommitdiff
path: root/Runtime/Graphs/UnityEngine.Graphs/Attributes.cs
blob: 1e6bca93b3ad0691131e3b92417fc4519ff73e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using System;

namespace UnityEngine.Graphs.LogicGraph
{
	[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)]
	public class SettingAttribute : Attribute { }

	// TODO : should be abstract
	// for almost everything logic graph related (classes, functions, variables, ...)
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property)]
	public class CodeGeneratingLogicAttribute : Attribute
	{
		public Type type;
		public Type inputsType;
		public Type stateType;
	}

	// for almost everything logic graph related (classes, functions, variables, ...)
	public class LogicAttribute : CodeGeneratingLogicAttribute
	{
		public LogicAttribute() { type = null; }
		public LogicAttribute(Type type) { this.type = type; }
		public LogicAttribute(Type type, Type inputsType)
		{
			base.type = type;
			base.inputsType = inputsType;
		}
		public LogicAttribute(Type type, Type inputsType, Type stateType)
		{
			base.type = type;
			base.inputsType = inputsType;
			base.stateType = stateType;
		}
	}

	// for evaluator nodes
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
	public class LogicEvalAttribute : Attribute
	{
		public Type type;
		public Type stateType;

		public LogicEvalAttribute() { type = null; }
		public LogicEvalAttribute(Type type) { this.type = type; }
		public LogicEvalAttribute(Type type, Type stateType)
		{
			this.type = type;
			this.stateType = stateType;
		}
	}

	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
	public class LogicExpressionAttribute: Attribute
	{
		public string name;
		public LogicExpressionAttribute() { name = string.Empty;}
		public LogicExpressionAttribute(string name) { this.name = name; }
	}

	[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
	public class LogicTargetAttribute : Attribute { }

	[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
	public class TitleAttribute : Attribute
	{
		public string title;
		public TitleAttribute(string title) { this.title = title; }		
	}

	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property)]
	public class ValidateAttribute : Attribute
	{
		public string validateFunction;
		public ValidateAttribute(string validateFunction) { this.validateFunction = validateFunction; }
	}
	
	#if UNITY_ANIMATION_GRAPH
	// for almost everything logic graph related (classes, functions, variables, ...)
	public class AnimationLogicAttribute : CodeGeneratingLogicAttribute
	{
		public AnimationLogicAttribute() { type = null; }
		public AnimationLogicAttribute(Type type) { base.type = type; }
		public AnimationLogicAttribute(Type type, Type inputsType)
		{
			base.type = type;
			base.inputsType = inputsType;
		}
		public AnimationLogicAttribute(Type type, Type inputsType, Type stateType)
		{
			base.type = type;
			base.inputsType = inputsType;
			base.stateType = stateType;
		}
	}
	#endif
}