File size: 1,616 Bytes
00437a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
namespace Quantum
{
	using Photon.Deterministic;

	public unsafe partial struct Buff
	{
		// PUBLIC MEMBERS

		public bool IsFinished { get { return Flags.IsBitSet(0); } set { Flags = Flags.SetBit(0, value); } }

		// PUBLIC METHODS

		public void Initialize(Frame frame, EntityRef entity, Buff* buff, byte level)
		{
			var behaviors = frame.ResolveList(Behaviors);

			for (int idx = 0, count = behaviors.Count; idx < count; idx++)
			{
				behaviors.GetPointer(idx)->Initialize(frame, entity, buff, level);
			}
		}

		public void Deinitialize(Frame frame, EntityRef entity, Buff* buff)
		{
			var behaviors = frame.ResolveList(Behaviors);

			for (int idx = 0, count = behaviors.Count; idx < count; idx++)
			{
				behaviors.GetPointer(idx)->Deinitialize(frame, entity, buff);
			}
		}

		public void Refresh(Frame frame, EntityRef entity, Buff* buff)
		{
			var behaviors = frame.ResolveList(Behaviors);

			for (int idx = 0, count = behaviors.Count; idx < count; idx++)
			{
				behaviors.GetPointer(idx)->Refresh(buff);
			}
		}

		public void Update(Frame frame, Buff* buff)
		{
			var behaviors = frame.ResolveList(Behaviors);

			for (int idx = 0, count = behaviors.Count; idx < count; idx++)
			{
				behaviors.GetPointer(idx)->Update(frame, buff);
			}
		}

		public (FP, FP) GetDuration(Frame frame)
		{
			var behaviors = frame.ResolveList(Behaviors);

			for (int idx = 0, count = behaviors.Count; idx < count; idx++)
			{
				var (duration, maxDuration) = behaviors[idx].GetDuration();
				if (maxDuration > FP._0)
					return (duration, maxDuration);
			}

			return (default, default);
		}
	}
}