File size: 702 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
namespace Quantum
{
	using Photon.Deterministic;

	public unsafe partial struct EffectAreaBehavior_Damage
	{
		public void Initialize(byte level)
		{
			var perLevel = FP._1 + DamagePerLevelPercent * FP._0_01;

			for (int idx = 1; idx < level; idx++)
			{
				Damage *= perLevel;
			}
		}

		public void ProcessEffect(Frame frame, EntityRef entity, EntityRef target)
		{
			var position   = frame.Unsafe.GetPointer<Transform2D>(entity)->Position;
			var healthData = new HealthData()
			{
				Action = EHealthAction.Remove,
				Value  = Damage,
				Target = target,
			};

			var targetHealth = frame.Unsafe.GetPointer<Health>(target);
			targetHealth->ApplyHealthData(frame, healthData);
		}
	}
}