File size: 759 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
using System;
using Photon.Deterministic;

namespace Quantum
{
	[Serializable]
	[AssetObjectConfig(GenerateLinkingScripts = true, GenerateAssetCreateMenu = false, GenerateAssetResetMethod = false)]
	public partial class TimerDecision : HFSMDecision
	{
		public AIParamFP TimeToTrueState = FP._3;

		public override unsafe bool Decide(Frame frame, EntityRef entity)
		{
			var blackboard = frame.Has<AIBlackboardComponent>(entity) ? frame.Get<AIBlackboardComponent>(entity) : default;

			var agent = frame.Unsafe.GetPointer<HFSMAgent>(entity);
			var aiConfig = agent->GetConfig(frame);

			FP requiredTime = TimeToTrueState.Resolve(frame, entity, &blackboard, aiConfig);

			var hfsmData = &agent->Data;
			return hfsmData->Time >= requiredTime;
		}
	}
}