This commit is contained in:
Aaron Kimbre 2023-01-07 01:15:27 -06:00
parent a580e3a2f5
commit bb20aa7f86

View File

@ -1,6 +1,7 @@
#include "JetPackBehavior.h" #include "JetPackBehavior.h"
#include "BehaviorBranchContext.h" #include "BehaviorBranchContext.h"
#include "ControllablePhysicsComponent.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Character.h" #include "Character.h"
@ -12,11 +13,11 @@ void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_st
if (entity->IsPlayer()) { if (entity->IsPlayer()) {
auto* character = entity->GetCharacter(); auto* character = entity->GetCharacter();
if (character) character->SetIsFlying(true);
}
if (character) { auto controllablePhysicsComponent = entity->GetComponent<ControllablePhysicsComponent>();
character->SetIsFlying(true); if (controllablePhysicsComponent) controllablePhysicsComponent->Ser
}
}
} }
void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
@ -26,10 +27,7 @@ void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext bra
if (entity->IsPlayer()) { if (entity->IsPlayer()) {
auto* character = entity->GetCharacter(); auto* character = entity->GetCharacter();
if (character) character->SetIsFlying(false);
if (character) {
character->SetIsFlying(false);
}
} }
} }