-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchLever.cpp
More file actions
31 lines (24 loc) · 926 Bytes
/
Copy pathSwitchLever.cpp
File metadata and controls
31 lines (24 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Fill out your copyright notice in the Description page of Project Settings.
#include "SwitchLever.h"
#include "Components/PointLightComponent.h"
#include "Components/SphereComponent.h"
#include "MovingPlatforms.h"
// Sets default values
ASwitchLever::ASwitchLever()
{
PrimaryActorTick.bCanEverTick = true;
LightIntensity = 3000.0f;
PointLight = CreateDefaultSubobject<UPointLightComponent>(TEXT("Point Light"));
PointLight->Intensity = LightIntensity;
PointLight->bVisible = true;
RootComponent = PointLight;
LightSphere = CreateDefaultSubobject<USphereComponent>(TEXT("Light Sphere Component"));
LightSphere->InitSphereRadius(300.0f);
LightSphere->SetCollisionProfileName(TEXT("Trigger"));
LightSphere->SetCollisionResponseToChannel(ECC_Pawn, ECR_Ignore);
LightSphere->SetupAttachment(RootComponent);
}
void ASwitchLever::ToggleLight()
{
PointLight->ToggleVisibility();
}