mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-24 06:27:24 +00:00
Make better
This commit is contained in:
parent
051395e4c9
commit
0e8af24572
@ -30,7 +30,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
|
|
||||||
Game::logger->LogDebug("SwitchBehavior", "[%i] State: (%d), imagination: (%i) / (%f)", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
|
Game::logger->LogDebug("SwitchBehavior", "[%i] State: (%d), imagination: (%i) / (%f)", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
|
||||||
|
|
||||||
if (state && destroyableComponent->GetImagination() >= m_imagination) {
|
if (state) {
|
||||||
this->m_actionTrue->Handle(context, bitStream, branch);
|
this->m_actionTrue->Handle(context, bitStream, branch);
|
||||||
} else {
|
} else {
|
||||||
this->m_actionFalse->Handle(context, bitStream, branch);
|
this->m_actionFalse->Handle(context, bitStream, branch);
|
||||||
|
@ -196,18 +196,18 @@ void RebuildComponent::Update(float deltaTime) {
|
|||||||
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
|
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
|
||||||
if (!destComp) break;
|
if (!destComp) break;
|
||||||
|
|
||||||
int newImagination = destComp->GetImagination() - 1;
|
int newImagination = destComp->GetImagination();
|
||||||
|
if (newImagination <= 0) {
|
||||||
|
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++m_DrainedImagination;
|
||||||
|
--newImagination;
|
||||||
destComp->SetImagination(newImagination);
|
destComp->SetImagination(newImagination);
|
||||||
EntityManager::Instance()->SerializeEntity(builder);
|
EntityManager::Instance()->SerializeEntity(builder);
|
||||||
|
|
||||||
++m_DrainedImagination;
|
|
||||||
|
|
||||||
if (newImagination <= 0 && m_DrainedImagination < m_TakeImagination) {
|
|
||||||
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
||||||
|
Loading…
Reference in New Issue
Block a user