Lay out initial room
This commit is contained in:
parent
a6fcdf631f
commit
122bd96a81
Binary file not shown.
Binary file not shown.
45
RoomEscape/Source/RoomEscape/OpenDoor.cpp
Normal file
45
RoomEscape/Source/RoomEscape/OpenDoor.cpp
Normal 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);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
29
RoomEscape/Source/RoomEscape/OpenDoor.h
Normal file
29
RoomEscape/Source/RoomEscape/OpenDoor.h
Normal 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;
|
||||
|
||||
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user