Level 2 #12

Merged
oleg.petruny merged 14 commits from Level2 into master 2025-04-25 21:17:42 +00:00
22 changed files with 59 additions and 39 deletions
Showing only changes of commit cb905f62f1 - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
UnrealProject/Lost_Edge/Content/Audio/Sounds/SW_Clock.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
UnrealProject/Lost_Edge/Content/Audio/Sounds/SW_Knock.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -107,9 +107,21 @@ void AInteractable::BeginPlay()
}
}
GetComponents(collisions, true);
for(auto collision : collisions)
GetComponents(collisions);
for(int32 i = 0; i < collisions.Num(); ++i)
{
auto collision = collisions[i];
switch(collision->GetCollisionResponseToChannel(GetCollisionChannel()))
{
case ECollisionResponse::ECR_Ignore:
case ECollisionResponse::ECR_Overlap:
collisions.RemoveAt(i, EAllowShrinking::No);
--i;
continue;
default:
break;
}
if(activatorTypes)
{
collision->SetCollisionProfileName(collisionProfile);
@ -128,9 +140,13 @@ void AInteractable::BeginPlay()
collision->SetRenderCustomDepth(true);
}
}
collisions.Shrink();
if(auto PC = UGameplayStatics::GetPlayerController(GetWorld(), 0))
player = Cast<APlayerBase>(PC->GetPawn());
if(lockOnBeginPlay)
Lock();
}
void AInteractable::EndPlay(const EEndPlayReason::Type EndPlayReason)

View File

@ -87,6 +87,9 @@ protected:
/** Mask of active activator types */
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (Bitmask, BitmaskEnum = "EActivatorType"))
int32 activated = 0;
UPROPERTY(EditAnywhere)
bool lockOnBeginPlay = false;
TArray<UPrimitiveComponent*> collisions;
/** TArray cannot be a value of a TMap */
struct FModificatorsArray
@ -96,8 +99,6 @@ protected:
/** Map of modificators to activator types initialized on BeginPlay */
TMap<EActivatorType, FModificatorsArray> modificators;
TArray<UPrimitiveComponent*> collisions;
class APlayerBase* player = nullptr;
};