A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
IntroMediaScreen.cpp
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3
5
6#include "Components/AudioComponent.h"
7#include "Kismet/GameplayStatics.h"
9
10// Sets default values
12{
13 // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
14 PrimaryActorTick.bCanEverTick = true;
15
16 Root = CreateDefaultSubobject<USceneComponent>("Root");
17 Root->SetupAttachment(RootComponent);
18
19 PlaneComponent = CreateDefaultSubobject<UStaticMeshComponent>("Plane");
20 PlaneComponent->SetupAttachment(Root);
21 PlaneComponent->SetRelativeRotation(FRotator(90.0, 0, -90.0));
22 PlaneComponent->SetRelativeScale3D(FVector(1.77, 1.0, 1.0));
23
24 Audio = CreateDefaultSubobject<UAudioComponent>("Audio");
25 Audio->SetupAttachment(Root);
26}
27
28// Called when the game starts or when spawned
30{
31 Super::BeginPlay();
32 if (MediaPlayer)
33 {
34 MediaPlayer->OpenSource(MediaSource);
35 Audio->Play();
36 MediaPlayer->OnEndReached.AddDynamic(this, &AIntroMediaScreen::OnVideoEndPlaying);
37 }
38}
39
40// Called every frame
41void AIntroMediaScreen::Tick(float DeltaTime)
42{
43 Super::Tick(DeltaTime);
44
45}
46
48{
49 UGameplayStatics::OpenLevel(this, UPixoVRFunctionLibrary::GetMapAfterIntro());
50}
51
UAudioComponent * Audio
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
UMediaSource * MediaSource
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MediaScreen")
USceneComponent * Root
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
UMediaPlayer * MediaPlayer
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MediaScreen")
virtual void Tick(float DeltaTime) override
UStaticMeshComponent * PlaneComponent
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
virtual void BeginPlay() override
void OnVideoEndPlaying()
UFUNCTION()
static FName GetMapAfterIntro()
Retrieves the map name to load after the introduction.