File size: 1,451 Bytes
ce81a16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
using Photon.Deterministic;

namespace Quantum
{
	public abstract unsafe partial class GOAPGoal
	{
		public enum EInterruptionBehavior
		{
			Never,
			Always,
			BasedOnActions,
		}

		// PUBLIC MEMBERS

		public string                Label;

		[BotSDKHidden]
		public GOAPState             StartState;
		[BotSDKHidden]
		public GOAPState             TargetState;
		public EInterruptionBehavior InterruptionBehavior;

		// PUBLIC INTERFACE

		public virtual FP GetRelevancy(Frame frame, GOAPEntityContext context)
		{
			return 1;
		}

		public virtual void InitPlanning(Frame frame, GOAPEntityContext context, ref GOAPState startState, ref GOAPState targetState)
		{
			startState.Merge(StartState);
			targetState.Merge(TargetState);
		}

		public virtual void Activate(Frame frame, GOAPEntityContext context)
		{
		}

		public virtual void Deactivate(Frame frame, GOAPEntityContext context)
		{
		}

		public virtual bool HasFinished(Frame frame, GOAPEntityContext context)
		{
			return context.Agent->CurrentState.Contains(context.Agent->GoalState);
		}

		public bool IsInterruptible(GOAPAction currentAction)
		{
			if (InterruptionBehavior == EInterruptionBehavior.Never)
				return false;

			if (InterruptionBehavior == EInterruptionBehavior.Always)
				return true;

			return currentAction != null && currentAction.Interruptible;
		}

		public virtual FP GetDisableTime(Frame frame, GOAPEntityContext context)
		{
			return 0;
		}
	}
}