Produktion_Digitaler_Medien/Source/BuildingEscape/RotatingActor.h

52 lines
1.0 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/ActorComponent.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);
UFUNCTION(BlueprintCallable)
void Rotate();
public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditAnywhere)
float TargetAngle = 90.0f;
UPROPERTY(EditAnywhere)
float RotationSpeed = 15.f;
UPROPERTY(EditAnywhere)
float RotationDelay = 0.f;
UPROPERTY(EditAnywhere)
bool Negative = false;
UPROPERTY(EditAnywhere)
float Tolerance = 1.f;
private:
FRotator targetRotation;
bool rotating;
bool soundHasBeenPlayed;
float tempRotation;
void Move(FRotator TargetRotation);
};