super-duper-spoon/Source/Shooter/ShooterAnimInstance.h

115 lines
3.6 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "ShooterAnimInstance.generated.h"
class AShooterCharacter;
UENUM(BlueprintType)
enum class EOffsetState : uint8
{
EOS_Aiming UMETA(DisplayName = "Aiming"),
EOS_Hip UMETA(DisplayName = "Hip"),
EOS_Reloading UMETA(DisplayName = "Reloading"),
EOS_InAir UMETA(DisplayName = "InAir"),
EOS_MAX UMETA(DisplayName = "DefaultMax")
};
/**
*
*/
UCLASS()
class SHOOTER_API UShooterAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UShooterAnimInstance();
UFUNCTION(BlueprintCallable)
void UpdateAnimationProperties(float DeltaTime);
virtual void NativeInitializeAnimation() override;
protected:
/** Handle turning in place variables */
void TurnInPlace();
/** Handle calculations for leaning while running */
void Lean(float DeltaTime);
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true))
AShooterCharacter* ShooterCharacter;
/* The speed of the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true))
float Speed;
/* Whether or not the character is in the air */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true))
bool bIsInAir;
/* Whether or not the character is moving */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true))
bool bIsAccelerating;
/* Offset YAW used for strafing */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement, meta = (AllowPrivateAccess = true))
float MovementOffsetYaw;
/* Offset YAW the frame before we stopped moving */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement, meta = (AllowPrivateAccess = true))
float LastMovementOffsetYaw;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true))
bool bAiming;
/** Turn In Place: Yaw of the character this frame; Only updated when standing still and not in the air */
float TIPCharacterYaw;
/** Turn In Place: Yaw of the character the previous frame; Only updated when standing still and not in the air */
float TIPCharacterYawLastFrame;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Turn In Place", meta = (AllowPrivateAccess = true))
float RootYawOffset;
/** Rotation curve value this frame */
float RotationCurve;
/** Rotation curve value last frame */
float RotationCurveLastFrame;
/** The pitch of the aim rotation used for aim offset */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Turn In Place", meta = (AllowPrivateAccess = true))
float Pitch;
/** True when reloading, used to prevent aim offset when reloading */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Turn In Place", meta = (AllowPrivateAccess = true))
bool bReloading;
/** Offset state; used to determine which Aim Offset to use */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Turn In Place", meta = (AllowPrivateAccess = true))
EOffsetState OffsetState;
/** Yaw of the character this frame */
FRotator CharacterRotation;
/** Yaw of the character the previous frame */
FRotator CharacterRotationLastFrame;
/** Yaw delta used for leaning while running in the blendspace */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Lean", meta = (AllowPrivateAccess = true))
double YawDelta;
/** True when crouching */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Crouching", meta = (AllowPrivateAccess = true))
bool bCrouching;
};