Moving setting of light colour to BeginPlay

This commit is contained in:
Louis Hobbs 2023-06-24 15:25:06 +01:00
parent bbe5f04b72
commit b51f3a7a34
2 changed files with 3 additions and 1 deletions

View File

@ -19,7 +19,6 @@ APickup::APickup()
SphereComponent->SetupAttachment(RootComponent); SphereComponent->SetupAttachment(RootComponent);
PointLightComponent = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComponent")); PointLightComponent = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComponent"));
PointLightComponent->SetLightColor(FLinearColor::FromSRGBColor(LightColor));
PointLightComponent->SetupAttachment(RootComponent); PointLightComponent->SetupAttachment(RootComponent);
} }
@ -29,6 +28,7 @@ void APickup::BeginPlay()
Super::BeginPlay(); Super::BeginPlay();
SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &APickup::OnOverlapBegin); SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &APickup::OnOverlapBegin);
PointLightComponent->SetLightColor(FLinearColor::FromSRGBColor(LightColor));
PointLightComponent->SetWorldLocation(this->GetActorLocation()); PointLightComponent->SetWorldLocation(this->GetActorLocation());
} }

View File

@ -8,6 +8,8 @@
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "Pickup.generated.h" #include "Pickup.generated.h"
// TODO: We probably want to add some extra stuff here, particle effects, sounds, etc
UCLASS() UCLASS()
class NAKATOMI_API APickup : public AActor class NAKATOMI_API APickup : public AActor
{ {