Produktion_Digitaler_Medien/Source/BuildingEscape/RotatingActor.h

45 lines
938 B
C++

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/ActorComponent.h"
#include "Components/AudioComponent.h"
#include "RotatingActor.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API URotatingActor : public UActorComponent
{
GENERATED_BODY()
public:
URotatingActor();
protected:
virtual void BeginPlay() override;
void rotate(FRotator targetRotation);
void rotate();
public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditAnywhere)
float TargetAngle = 90.0f;
UPROPERTY(EditAnywhere)
UAudioComponent * AudioComponent;
UPROPERTY(EditAnywhere)
float RotationSpeed = 15.f;
UPROPERTY(EditAnywhere)
float RotationDelay = 2.f;
private:
FRotator targetRotation;
bool rotating;
bool soundHasBeenPlayed;
};