Produktion_Digitaler_Medien/Source/BuildingEscape/MovingActor.h

53 lines
1.0 KiB
C
Raw Normal View History

2021-01-19 15:25:56 +01:00
#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();
2021-01-19 15:25:56 +01:00
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;
2021-02-02 14:09:40 +01:00
UPROPERTY(EditAnywhere)
bool Up = false;
2021-01-19 15:25:56 +01:00
private:
bool moving = false;
2021-01-19 15:25:56 +01:00
bool soundHasBeenPlayed;
FVector targetLocation;
FVector tempLocation;
void PlaySound();
2021-01-19 15:25:56 +01:00
};