Lay out initial room

This commit is contained in:
Tyrel Souza 2018-02-19 13:38:28 -05:00
parent a6fcdf631f
commit 122bd96a81
4 changed files with 74 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,45 @@
// Tyrel Souza 2018
#include "OpenDoor.h"
#include "GameFramework/Actor.h" // See auto completes
// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
AActor* Owner = GetOwner();
FString ObjectName = Owner->GetName();
FString Rot = Owner->GetTransform().GetRotation().GetAxisZ().ToString();
UE_LOG(LogTemp, Warning, TEXT("%s is at: %s"), *ObjectName, *Rot);
FRotator NewRotation = FRotator(0.0f, -90.0f, 0.0f);
Owner->SetActorRotation(NewRotation);
}
// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}

View File

@ -0,0 +1,29 @@
// Tyrel Souza 2018
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "OpenDoor.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class ROOMESCAPE_API UOpenDoor : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOpenDoor();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};