Monolith/Source/Monolith/PilotCameraShake.h

55 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Camera/CameraShakeSourceComponent.h"
#include "PilotCameraShake.generated.h"
class FMoveState;
UCLASS(Blueprintable, ClassGroup=Camera, meta=(BlueprintSpawnableComponent))
class MONOLITH_API UPilotCameraShake : public UCameraShakeSourceComponent
{
GENERATED_BODY()
enum EState{Idling, Walking, Running, Floating};
void BeginPlay() override;
bool CantUpdate();
bool isMoveStateSet() const;
bool TrySetMoveState();
UFUNCTION(BlueprintCallable)
void UpdateCameraShake();
void SetCameraShakeBase(TSubclassOf<UCameraShakeBase> ShakeBase);
FTimerHandle TickHandle;
FMoveState* MoveState;
EState CurrentState = Idling;
UPROPERTY(EditDefaultsOnly, Category = "Cam Shake", meta=(AllowPrivateAccess = "true"))
TSubclassOf<UCameraShakeBase> RunningShake;
UPROPERTY(EditDefaultsOnly, Category = "Cam Shake", meta=(AllowPrivateAccess = "true"))
TSubclassOf<UCameraShakeBase> WalkingShake;
UPROPERTY(EditDefaultsOnly, Category = "Cam Shake", meta=(AllowPrivateAccess = "true"))
TSubclassOf<UCameraShakeBase> FloatingShake;
UPROPERTY(EditDefaultsOnly, Category = "Cam Shake", meta=(AllowPrivateAccess = "true"))
TSubclassOf<UCameraShakeBase> IdleShake;
};
inline bool UPilotCameraShake::CantUpdate()
{
return !isMoveStateSet() && !TrySetMoveState();
}
inline bool UPilotCameraShake::isMoveStateSet() const
{
return MoveState != nullptr;
}