File size: 820 Bytes
ac55997
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
using System;
using Photon.Deterministic;
using Quantum.Task;

namespace Quantum
{
	public unsafe class TraktorInputSystem : SystemThreadedFilter<TraktorInputSystem.Filter>, ISignalOnComponentAdded<Traktor>
	{
		public struct Filter
		{
			public EntityRef Entity;
			public Transform3D* Transform;
			public Traktor* Traktor;
		}

		public void OnAdded(Frame frame, EntityRef entity, Traktor* traktor)
		{
			EntityRef sphere = frame.Create(traktor->SpherePrototype);
			traktor->Sphere = sphere;

		}

		public override void Update(FrameThreadSafe frame, ref Filter filter)
		{
			Input input = default;
			if (frame.TryGetPointer<Controller>(filter.Entity, out var controller))
			{
				input = *((Frame)frame).GetPlayerInput(controller->Player);
			}
			filter.Traktor->Update(frame, ref filter, input);
		}
	}
}