1ALightSwitchTrigger::ALightSwitchTrigger()
2{
3 // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
4 PrimaryActorTick.bCanEverTick = true;
5
6 LightIntensity = 3000.0f;
7
8 PointLight = CreateDefaultSubobject<UPointLightComponent>(TEXT("Point Light"));
9 PointLight->Intensity = LightIntensity;
10 PointLight->bVisible = true;
11 RootComponent = PointLight;
12
13 LightSphere = CreateDefaultSubobject<USphereComponent>(TEXT("Light Sphere Component"));
14 LightSphere->InitSphereRadius(300.0f);
15 LightSphere->SetCollisionProfileName(TEXT("Trigger"));
16 LightSphere->SetupAttachment(RootComponent);
17
18 LightSphere->OnComponentBeginOverlap.AddDynamic(this, &ALightSwitchTrigger::OnOverlapBegin);
19 LightSphere->OnComponentEndOverlap.AddDynamic(this, &ALightSwitchTrigger::OnOverlapEnd);
20
21}
22