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 = 2.f;
|
|
|
|
|
2020-12-08 12:21:49 +01:00
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
bool Negative = false;
|
|
|
|
|
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;
|
2020-12-03 14:12:54 +01:00
|
|
|
};
|