2021-12-05 17:54:36 +00:00
|
|
|
#include "FvDragonSmashingGolemQb.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "EntityManager.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "RenderComponent.h"
|
|
|
|
#include "Entity.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "eRebuildState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
|
|
|
|
self->AddTimer("GolemBreakTimer", 10.5f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "GolemBreakTimer") {
|
|
|
|
self->Smash();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
2023-05-02 22:39:21 +00:00
|
|
|
if (state == eRebuildState::COMPLETED) {
|
2023-03-20 13:10:52 +00:00
|
|
|
RenderComponent::PlayAnimation(self, u"dragonsmash");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
|
|
|
|
|
|
|
|
auto* dragon = EntityManager::Instance()->GetEntity(dragonId);
|
|
|
|
|
|
|
|
if (dragon != nullptr) {
|
|
|
|
dragon->OnFireEventServerSide(self, "rebuildDone");
|
|
|
|
}
|
|
|
|
|
|
|
|
self->CancelTimer("GolemBreakTimer");
|
|
|
|
self->AddTimer("GolemBreakTimer", 10.5f);
|
|
|
|
}
|
|
|
|
}
|