Produktion_Digitaler_Medien/Source/BuildingEscape/RotatingActor.h

52 lines
1.0 KiB
C
Raw Normal View History

2020-12-03 14:12:54 +01:00
#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;
2020-12-08 12:21:49 +01:00
void Rotate(FRotator TargetRotation);
2021-01-19 15:25:56 +01:00
UFUNCTION(BlueprintCallable)
2020-12-08 12:21:49 +01:00
void Rotate();
2020-12-03 14:12:54 +01:00
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;
2020-12-03 14:12:54 +01:00
2020-12-08 12:21:49 +01:00
UPROPERTY(EditAnywhere)
bool Negative = false;
2021-03-13 19:57:51 +01:00
UPROPERTY(EditAnywhere)
float Tolerance = 1.f;
2020-12-08 12:21:49 +01:00
2020-12-03 14:12:54 +01:00
private:
FRotator targetRotation;
bool rotating;
bool soundHasBeenPlayed;
2020-12-08 12:21:49 +01:00
float tempRotation;
void Move(FRotator TargetRotation);
2020-12-03 14:12:54 +01:00
};