[박치영] Sprint Animation 추가
parent
b83ca133ca
commit
3a78d0a63f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Actor/BaseEquippable.h"
|
#include "Actor/BaseEquippable.h"
|
||||||
#include "Enums/CombatType.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "Animation/CombatAnimInstance.h"
|
#include "Animation/CombatAnimInstance.h"
|
||||||
#include "Components/StateManagerComponent.h"
|
#include "Components/StateManagerComponent.h"
|
||||||
#include "BaseWeapon.generated.h"
|
#include "BaseWeapon.generated.h"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Animation/AnimInstance.h"
|
#include "Animation/AnimInstance.h"
|
||||||
#include "Interface/IAnimInstance.h"
|
#include "Interface/IAnimInstance.h"
|
||||||
#include "Enums/CombatType.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "CombatAnimInstance.generated.h"
|
#include "CombatAnimInstance.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,6 +36,9 @@ ACombatCharacter::ACombatCharacter()
|
||||||
|
|
||||||
// Note: For faster iteration times these variables, and many more, can be tweaked in the Character Blueprint
|
// Note: For faster iteration times these variables, and many more, can be tweaked in the Character Blueprint
|
||||||
// instead of recompiling to adjust them
|
// instead of recompiling to adjust them
|
||||||
|
GetCharacterMovement()->MaxAcceleration = 1500.f;
|
||||||
|
GetCharacterMovement()->BrakingFrictionFactor = 1.f;
|
||||||
|
GetCharacterMovement()->bUseSeparateBrakingFriction = true; //Sprint 시 애니메이션이 끊기는 거 방지
|
||||||
GetCharacterMovement()->JumpZVelocity = 700.f;
|
GetCharacterMovement()->JumpZVelocity = 700.f;
|
||||||
GetCharacterMovement()->AirControl = 0.35f;
|
GetCharacterMovement()->AirControl = 0.35f;
|
||||||
GetCharacterMovement()->MaxWalkSpeed = 500.f;
|
GetCharacterMovement()->MaxWalkSpeed = 500.f;
|
||||||
|
@ -68,6 +71,12 @@ ACombatCharacter::ACombatCharacter()
|
||||||
StateManagerComponent->OnActionBegin.AddUObject(this, &ACombatCharacter::CharacterActionBegin);
|
StateManagerComponent->OnActionBegin.AddUObject(this, &ACombatCharacter::CharacterActionBegin);
|
||||||
StateManagerComponent->OnActionEnd.AddUObject(this, &ACombatCharacter::CharacterActionEnd);
|
StateManagerComponent->OnActionEnd.AddUObject(this, &ACombatCharacter::CharacterActionEnd);
|
||||||
|
|
||||||
|
//Setting MovementSpeed
|
||||||
|
MovementSpeedMode = EMovementSpeedMode::Jogging;
|
||||||
|
WalkingSpeed = 200.f;
|
||||||
|
JoggingSpeed = 500.f;
|
||||||
|
SprintSpeed = 700.f;
|
||||||
|
|
||||||
Health = 100.f;
|
Health = 100.f;
|
||||||
PelvisBoneName = TEXT("pelvis");
|
PelvisBoneName = TEXT("pelvis");
|
||||||
}
|
}
|
||||||
|
@ -191,6 +200,13 @@ void ACombatCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerIn
|
||||||
|
|
||||||
//Dodge
|
//Dodge
|
||||||
EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &ACombatCharacter::Dodge);
|
EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &ACombatCharacter::Dodge);
|
||||||
|
|
||||||
|
//ToggleWalk
|
||||||
|
EnhancedInputComponent->BindAction(ToggleWalkAction, ETriggerEvent::Started, this, &ACombatCharacter::ToggleWalk);
|
||||||
|
|
||||||
|
//Sprint
|
||||||
|
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &ACombatCharacter::StartSprint);
|
||||||
|
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &ACombatCharacter::StopSprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +296,26 @@ void ACombatCharacter::Dodge(const FInputActionValue& Value)
|
||||||
PerformDodge();
|
PerformDodge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACombatCharacter::ToggleWalk(const FInputActionValue& Value)
|
||||||
|
{
|
||||||
|
if (GetMovementSpeedMode() != EMovementSpeedMode::Walking)
|
||||||
|
SetMovementSpeedMode(EMovementSpeedMode::Walking);
|
||||||
|
else
|
||||||
|
SetMovementSpeedMode(EMovementSpeedMode::Jogging);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACombatCharacter::StartSprint(const FInputActionValue& Value)
|
||||||
|
{
|
||||||
|
SetMovementSpeedMode(EMovementSpeedMode::Sprinting);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACombatCharacter::StopSprint(const FInputActionValue& Value)
|
||||||
|
{
|
||||||
|
if (GetMovementSpeedMode() == EMovementSpeedMode::Sprinting)
|
||||||
|
SetMovementSpeedMode(EMovementSpeedMode::Jogging);
|
||||||
|
}
|
||||||
|
|
||||||
void ACombatCharacter::CharacterStateBegin(ECharacterState CharState)
|
void ACombatCharacter::CharacterStateBegin(ECharacterState CharState)
|
||||||
{
|
{
|
||||||
switch (CharState)
|
switch (CharState)
|
||||||
|
@ -437,6 +473,28 @@ void ACombatCharacter::EnableRagdoll()
|
||||||
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(PelvisBoneName, 1.f);
|
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(PelvisBoneName, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACombatCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
||||||
|
{
|
||||||
|
if (NewSpeedMode == MovementSpeedMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MovementSpeedMode = NewSpeedMode;
|
||||||
|
switch (MovementSpeedMode)
|
||||||
|
{
|
||||||
|
case EMovementSpeedMode::Walking:
|
||||||
|
GetCharacterMovement()->MaxWalkSpeed = WalkingSpeed;
|
||||||
|
break;
|
||||||
|
case EMovementSpeedMode::Jogging:
|
||||||
|
GetCharacterMovement()->MaxWalkSpeed = JoggingSpeed;
|
||||||
|
break;
|
||||||
|
case EMovementSpeedMode::Sprinting:
|
||||||
|
GetCharacterMovement()->MaxWalkSpeed = SprintSpeed;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ACombatCharacter::PerformAttack(ECharacterAction attackType, int32 attackIndex)
|
void ACombatCharacter::PerformAttack(ECharacterAction attackType, int32 attackIndex)
|
||||||
{
|
{
|
||||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
||||||
|
@ -620,7 +678,8 @@ ECharacterAction ACombatCharacter::GetDesiredAttackType()
|
||||||
if (GetCharacterMovement()->IsFalling())
|
if (GetCharacterMovement()->IsFalling())
|
||||||
return ECharacterAction::FallingAttack;
|
return ECharacterAction::FallingAttack;
|
||||||
|
|
||||||
//TODO : Movement Speed Mode 추가
|
if (GetMovementSpeedMode() == EMovementSpeedMode::Sprinting)
|
||||||
|
return ECharacterAction::SprintAttack;
|
||||||
|
|
||||||
//TODO : Heavy Attack Ãß°¡
|
//TODO : Heavy Attack Ãß°¡
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "InputActionValue.h"
|
#include "InputActionValue.h"
|
||||||
#include "Interface/CombatInterface.h"
|
#include "Interface/CombatInterface.h"
|
||||||
#include "Components/StateManagerComponent.h"
|
#include "Components/StateManagerComponent.h"
|
||||||
|
#include "Definitions/GameEnums.h"
|
||||||
#include "CombatCharacter.generated.h"
|
#include "CombatCharacter.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +53,12 @@ class ACombatCharacter : public ACharacter, public ICombatInterface
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
class UInputAction* DodgeAction;
|
class UInputAction* DodgeAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
|
class UInputAction* ToggleWalkAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
|
class UInputAction* SprintAction;
|
||||||
public:
|
public:
|
||||||
ACombatCharacter();
|
ACombatCharacter();
|
||||||
|
|
||||||
|
@ -94,6 +101,9 @@ protected:
|
||||||
void ToggleCombat(const FInputActionValue& Value);
|
void ToggleCombat(const FInputActionValue& Value);
|
||||||
void LightAttack(const FInputActionValue& Value);
|
void LightAttack(const FInputActionValue& Value);
|
||||||
void Dodge(const FInputActionValue& Value);
|
void Dodge(const FInputActionValue& Value);
|
||||||
|
void ToggleWalk(const FInputActionValue& Value);
|
||||||
|
void StartSprint(const FInputActionValue& Value);
|
||||||
|
void StopSprint(const FInputActionValue& Value);
|
||||||
|
|
||||||
private://Delegate
|
private://Delegate
|
||||||
void CharacterStateBegin(ECharacterState CharState);
|
void CharacterStateBegin(ECharacterState CharState);
|
||||||
|
@ -107,6 +117,8 @@ private:
|
||||||
void CharacterTakeDamage(float InDamage);
|
void CharacterTakeDamage(float InDamage);
|
||||||
void ApplyHitReactionPhysicsVelocity(float InitialSpeed);
|
void ApplyHitReactionPhysicsVelocity(float InitialSpeed);
|
||||||
void EnableRagdoll();
|
void EnableRagdoll();
|
||||||
|
void SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode);
|
||||||
|
FORCEINLINE EMovementSpeedMode GetMovementSpeedMode() const { return MovementSpeedMode; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PerformAttack(ECharacterAction attackType, int32 attackIndex);
|
void PerformAttack(ECharacterAction attackType, int32 attackIndex);
|
||||||
|
@ -143,6 +155,18 @@ public:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
||||||
TObjectPtr<class UParticleSystem> HitEmitter;
|
TObjectPtr<class UParticleSystem> HitEmitter;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MovementSpeed", meta = (AllowPrivateAccess = "true"))
|
||||||
|
EMovementSpeedMode MovementSpeedMode;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MovementSpeed", meta = (AllowPrivateAccess = "true"))
|
||||||
|
float WalkingSpeed;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MovementSpeed", meta = (AllowPrivateAccess = "true"))
|
||||||
|
float JoggingSpeed;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MovementSpeed", meta = (AllowPrivateAccess = "true"))
|
||||||
|
float SprintSpeed;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats", meta = (AllowPrivateAccess = "true"))
|
||||||
float Health;
|
float Health;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "Components/CombatComponent.h"
|
#include "Components/CombatComponent.h"
|
||||||
#include "Actor/BaseWeapon.h"
|
#include "Actor/BaseWeapon.h"
|
||||||
#include "Enums/CombatType.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "Interface/IAnimInstance.h"
|
#include "Interface/IAnimInstance.h"
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
#include "Enums/CombatType.h"
|
#include "Definitions/GameEnums.h"
|
|
@ -13,3 +13,11 @@ enum class ECombatType : uint8
|
||||||
GREATSWORD UMETA(DisplayName = "GREATSWORD")
|
GREATSWORD UMETA(DisplayName = "GREATSWORD")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class EMovementSpeedMode : uint8
|
||||||
|
{
|
||||||
|
Walking UMETA(DisplayName = "Walking"),
|
||||||
|
Jogging UMETA(DisplayName = "Jogging"),
|
||||||
|
Sprinting UMETA(DisplayName = "Sprinting"),
|
||||||
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "UObject/Interface.h"
|
#include "UObject/Interface.h"
|
||||||
#include "Enums/CombatType.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "IAnimInstance.generated.h"
|
#include "IAnimInstance.generated.h"
|
||||||
|
|
||||||
// This class does not need to be modified.
|
// This class does not need to be modified.
|
||||||
|
|
Loading…
Reference in New Issue