2021-12-05 17:54:36 +00:00
|
|
|
|
#include "AirMovementBehavior.h"
|
|
|
|
|
#include "BehaviorBranchContext.h"
|
|
|
|
|
#include "BehaviorContext.h"
|
|
|
|
|
#include "EntityManager.h"
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
|
void AirMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
uint32_t handle;
|
|
|
|
|
|
|
|
|
|
bitStream->Read(handle);
|
|
|
|
|
|
|
|
|
|
context->RegisterSyncBehavior(handle, this, branch);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
|
void AirMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
const auto handle = context->GetUniqueSkillId();
|
|
|
|
|
|
|
|
|
|
bitStream->Write(handle);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
|
void AirMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
uint32_t behaviorId;
|
|
|
|
|
|
|
|
|
|
bit_stream->Read(behaviorId);
|
|
|
|
|
|
|
|
|
|
LWOOBJID target;
|
|
|
|
|
|
|
|
|
|
bit_stream->Read(target);
|
|
|
|
|
|
|
|
|
|
auto* behavior = CreateBehavior(behaviorId);
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
|
if (EntityManager::Instance()->GetEntity(target) != nullptr) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
branch.target = target;
|
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
|
behavior->Handle(context, bit_stream, branch);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
|
void AirMovementBehavior::Load() {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
}
|