custom-chatbot / data /TraktorInputSystem.cs
fastx's picture
Upload 84 files
ac55997
raw
history blame
820 Bytes
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);
}
}
}