Spaces:
Running
Running
File size: 1,450 Bytes
511a267 | 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 | #include "SingularitySpacetimeBridge.h"
void USingularitySpacetimeBridge::SubmitRoleInput(
ESingularityBodyRole Role,
float X,
float Z,
bool bAction,
int64 ClientTick)
{
FSingularityRoleInput Input;
if (static_cast<uint8>(Role) > 5 || !FMath::IsFinite(X) || !FMath::IsFinite(Z)) return;
Input.Role = Role;
Input.X = FMath::Clamp(X, -1.0f, 1.0f);
Input.Z = FMath::Clamp(Z, -1.0f, 1.0f);
Input.bAction = bAction;
Input.ClientTick = ClientTick;
OnInputReady.Broadcast(Input);
}
void USingularitySpacetimeBridge::ApplyTeamSnapshot(const FSingularityTeamSnapshot& Snapshot)
{
if (Snapshot.Nodes.Num() != 6) return;
for (const FVector& Node : Snapshot.Nodes) if (Node.ContainsNaN()) return;
// Snapshots are server-owned. Consumers should apply only the six nodes
// and status fields supplied here; no client-side completion is accepted.
OnSnapshotReady.Broadcast(Snapshot);
}
FString USingularitySpacetimeBridge::RoleToWireName(ESingularityBodyRole Role)
{
switch (Role)
{
case ESingularityBodyRole::EyesHead: return TEXT("0");
case ESingularityBodyRole::LeftArm: return TEXT("1");
case ESingularityBodyRole::RightArm: return TEXT("2");
case ESingularityBodyRole::TorsoBack: return TEXT("3");
case ESingularityBodyRole::LeftLeg: return TEXT("4");
case ESingularityBodyRole::RightLeg: return TEXT("5");
default: return TEXT("unknown");
}
}
|