FK v1.0.0 (build errors)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user