A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
InteractionValve.cpp
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3
5
6AInteractionValve::AInteractionValve(const FObjectInitializer& ObjectInitializer)
7 : Super(ObjectInitializer)
8{
9 PrimaryActorTick.bCanEverTick = true;
10 bReplicates = true;
11
12 static ConstructorHelpers::FObjectFinder<UStaticMesh> ValveMeshFinder(
13 TEXT("StaticMesh'/PixoCore/Meshes/InteractableObjects/SM_Valve_Top.SM_Valve_Top'"));
14 UStaticMesh* ValveMesh = ValveMeshFinder.Object;
15
16 Valve = CreateDefaultSubobject<UVRDialComponent>(TEXT("Valve"));
17 SetRootComponent(Valve);
18 Valve->SetStaticMesh(ValveMesh);
19
20 TextRenderComp = CreateDefaultSubobject<UTextRenderComponent>("TextRender");
21 TextRenderComp->SetupAttachment(Valve);
22 TextRenderComp->SetText(FText::FromString("Valve Text"));
23 TextRenderComp->SetWorldSize(20.0f);
24 TextRenderComp->SetHorizontalAlignment(EHTA_Center);
25 TextRenderComp->SetVerticalAlignment(EVRTA_TextCenter);
26 TextRenderComp->SetRelativeLocation(FVector(0.0f, 0.0f, 30.0f));
27}
28
29void AInteractionValve::Tick(float DeltaTime)
30{
31 Super::Tick(DeltaTime);
32
34 {
35 OnValveActivated.Broadcast();
36 }
37}
UVRDialComponent * Valve
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Components)
FOnValveActivated OnValveActivated
UPROPERTY(BlueprintAssignable)
virtual void Tick(float DeltaTime) override
float ActivateAngle
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Valve)
AInteractionValve(const FObjectInitializer &ObjectInitializer)
Sets default values for this actor's properties.
UTextRenderComponent * TextRenderComp
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
float CurrentDialAngle
UPROPERTY(BlueprintReadOnly, Category = "VRDialComponent")