Add random end of race behavior (#1056)

* randominze between 0 and 7 inclusive
for the different animation types

* Make the end behavior deterministic unpon loading
So that all players see the same animations for each other
This commit is contained in:
Aaron Kimbrell 2023-04-18 01:40:20 -05:00 committed by GitHub
parent fbfa778d3d
commit f60ea40acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : Component(par
m_DirtyPosition = true; m_DirtyPosition = true;
m_DirtyVelocity = true; m_DirtyVelocity = true;
m_DirtyAngularVelocity = true; m_DirtyAngularVelocity = true;
m_EndBehavior = GeneralUtils::GenerateRandomNumber<uint32_t>(0, 7);
} }
VehiclePhysicsComponent::~VehiclePhysicsComponent() { VehiclePhysicsComponent::~VehiclePhysicsComponent() {
@ -93,7 +94,7 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
} }
if (bIsInitialUpdate) { if (bIsInitialUpdate) {
outBitStream->Write<uint8_t>(5); outBitStream->Write<uint8_t>(m_EndBehavior);
outBitStream->Write1(); outBitStream->Write1();
} }

View File

@ -109,4 +109,5 @@ private:
bool m_IsOnRail; bool m_IsOnRail;
float m_SoftUpdate = 0; float m_SoftUpdate = 0;
uint32_t m_EndBehavior;
}; };