45 lines
950 B
C
45 lines
950 B
C
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "GameFramework//Actor.h"
|
||
|
#include "Components/ActorComponent.h"
|
||
|
#include "MovingActor.generated.h"
|
||
|
|
||
|
|
||
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||
|
class BUILDINGESCAPE_API UMovingActor : public UActorComponent
|
||
|
{
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
// Sets default values for this component's properties
|
||
|
UMovingActor();
|
||
|
|
||
|
protected:
|
||
|
// Called when the game starts
|
||
|
virtual void BeginPlay() override;
|
||
|
|
||
|
UFUNCTION(BlueprintCallable)
|
||
|
void Move();
|
||
|
|
||
|
public:
|
||
|
// Called every frame
|
||
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
|
||
|
FActorComponentTickFunction* ThisTickFunction) override;
|
||
|
|
||
|
UPROPERTY(EditAnywhere)
|
||
|
float MovementSpeed = 15.f;
|
||
|
|
||
|
UPROPERTY(EditAnywhere)
|
||
|
float MovementTarget = 10.f;
|
||
|
|
||
|
UPROPERTY(EditAnywhere)
|
||
|
bool Negative = false;
|
||
|
|
||
|
private:
|
||
|
bool moving;
|
||
|
bool soundHasBeenPlayed;
|
||
|
FVector targetLocation;
|
||
|
FVector tempLocation;
|
||
|
};
|