mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
impl mover and rotator loadconfigdata
This commit is contained in:
parent
7e42efa82e
commit
bb8d4f2eb7
@ -249,12 +249,40 @@ MoverPlatformSubComponent::MoverPlatformSubComponent(MovingPlatformComponent* pa
|
||||
|
||||
}
|
||||
|
||||
void MoverPlatformSubComponent::LoadConfigData() {
|
||||
m_AllowPositionSnapping = m_ParentComponent->GetParent()->GetVar<bool>(u"allowPosSnap");
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"maxLerpDist")){
|
||||
m_MaxLerpDistnace = m_ParentComponent->GetParent()->GetVar<float>(u"maxLerpDist");
|
||||
m_MaxLerpDistnace = m_MaxLerpDistnace * m_MaxLerpDistnace;
|
||||
}
|
||||
|
||||
}
|
||||
//------------- MoverPlatformSubComponent end --------------
|
||||
|
||||
//------------- RotatorPlatformSubComponent begin --------------
|
||||
|
||||
RotatorPlatformSubComponent::RotatorPlatformSubComponent(MovingPlatformComponent* parentComponent) : PlatformSubComponent(parentComponent) {
|
||||
|
||||
}
|
||||
void RotatorPlatformSubComponent::LoadConfigData() {
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"rotX")){
|
||||
m_Rotation.x = m_ParentComponent->GetParent()->GetVar<float>(u"rotX") * M_PI;
|
||||
}
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"rotY")){
|
||||
m_Rotation.y = m_ParentComponent->GetParent()->GetVar<float>(u"rotY") * M_PI;
|
||||
}
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"rotZ")){
|
||||
m_Rotation.z = m_ParentComponent->GetParent()->GetVar<float>(u"rotZ") * M_PI;
|
||||
}
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"allowRotSnap")){
|
||||
m_AllowRotationSnapping = m_ParentComponent->GetParent()->GetVar<bool>(u"allowRotSnap");
|
||||
}
|
||||
if(m_AllowRotationSnapping) {
|
||||
if(m_ParentComponent->GetParent()->HasVar(u"maxLerpAngle")){
|
||||
m_MaxLerpAngle = (m_ParentComponent->GetParent()->GetVar<float>(u"maxLerpAngle") * M_PI) / 180;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------- RotatorPlatformSubComponent end --------------
|
||||
|
@ -123,6 +123,11 @@ public:
|
||||
MoverPlatformSubComponent(MovingPlatformComponent* parentComponent);
|
||||
~MoverPlatformSubComponent() override = default;
|
||||
eMoverSubComponentType GetPlatformType() override { return eMoverSubComponentType::Mover; }
|
||||
void LoadConfigData() override;
|
||||
|
||||
private:
|
||||
bool m_AllowPositionSnapping = true;
|
||||
float m_MaxLerpDistnace = 16.0f;
|
||||
};
|
||||
|
||||
class RotatorPlatformSubComponent : public PlatformSubComponent {
|
||||
@ -131,7 +136,16 @@ public:
|
||||
RotatorPlatformSubComponent(MovingPlatformComponent* parentComponent);
|
||||
~RotatorPlatformSubComponent() override = default;
|
||||
eMoverSubComponentType GetPlatformType() override { return eMoverSubComponentType::Rotator; }
|
||||
void LoadConfigData() override;
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override { PlatformSubComponent::Serialize(outBitStream, bIsInitialUpdate); };
|
||||
private:
|
||||
NiPoint3 m_Rotation = NiPoint3Constant::ZERO;
|
||||
float m_Rate = 0.0f;
|
||||
NiPoint3 m_AngularVelocity = NiPoint3Constant::ZERO;
|
||||
bool m_AllowRotationSnapping = true;
|
||||
float m_MaxLerpAngle = 0.1396263;
|
||||
bool m_DirtyAngularVelocity = false;
|
||||
float m_UnknownFloat = 0.0f;
|
||||
};
|
||||
|
||||
// Only moves. Has NO path. This moving platform gets its initial position and rotation from the server on serialization.
|
||||
|
Loading…
Reference in New Issue
Block a user