FK v1.0.0 (build errors)

This commit is contained in:
2023-08-23 23:19:46 +02:00
parent abfc0e5114
commit 295144bc27
30 changed files with 38 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ void ABuildingBlock::TakeHit() {
HitsRemaining -= 1;
if (HitsRemaining <= 0) {
Ripple();
DestroyBlock();
}
}
@@ -54,10 +55,34 @@ TArray<ABuildingBlock*> ABuildingBlock::GetSameVariantNeighbours() {
}
void ABuildingBlock::DestroyBlock_Implementation() {
IsBeingDestroyed = true;
OnBlockDestroyed.ExecuteIfBound();
if (!IsBeingDestroyed) {
IsBeingDestroyed = true;
OnBlockDestroyed.ExecuteIfBound();
}
}
void ABuildingBlock::DestroyWithDelay_Implementation() {
IsBeingDestroyed = true;
OnBlockDestroyed.ExecuteIfBound();
}
void ABuildingBlock::Ripple() {
TArray<TEnumAsByte<EObjectTypeQuery>> TraceObjectTypes;
TraceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_Visibility));
TArray<AActor*> IgnoreActors;
IgnoreActors.Add(this);
TArray<AActor*> OutActors;
UKismetSystemLibrary::SphereOverlapActors(GetWorld(), this->GetActorLocation(), RippleRadius, TraceObjectTypes, ABuildingBlock::StaticClass(), IgnoreActors, OutActors);
for (AActor* OverlappedActor : OutActors) {
ABuildingBlock* ThisBlock = Cast<ABuildingBlock>(OverlappedActor);
if (ThisBlock && !ThisBlock->IsBeingDestroyed) {
float ThisDistance = UKismetMathLibrary::Vector_Distance(this->GetActorLocation(), ThisBlock->GetActorLocation());
ThisBlock->RippleEffects(ThisDistance);
}
}
}