Produktion_Digitaler_Medien/Source/BuildingEscape/MovingActor.h

53 lines
1.0 KiB
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();
UFUNCTION(BlueprintCallable)
void MoveBack();
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;
UPROPERTY(EditAnywhere)
bool Up = false;
private:
bool moving = false;
bool soundHasBeenPlayed;
FVector targetLocation;
FVector tempLocation;
void PlaySound();
};