[박치영] 나머지 무기 가드 기능 추가

main
pcyoung 2023-12-14 11:56:15 +09:00
parent 8c0f599634
commit 1909cc39cb
15 changed files with 26 additions and 2 deletions

View File

@ -42,6 +42,8 @@ ABaseWeapon::ABaseWeapon()
ActionDamageMultiplier.Add(FCombatGameplayTags::Get().Character_Action_Attack_ChargedAttack, 1.5f);
ActionDamageMultiplier.Add(FCombatGameplayTags::Get().Character_Action_Attack_FallingAttack, 1.2f);
ActionDamageMultiplier.Add(FCombatGameplayTags::Get().Character_Action_Attack_SprintAttack, 1.2f);
bCanBlock = true;
}
void ABaseWeapon::OnEquipped()

View File

@ -46,6 +46,8 @@ public:
public:
virtual TArray<UAnimMontage*> GetActionMontage(FGameplayTag characterAction);
public:
FORCEINLINE bool GetCanBlock() { return bCanBlock; }
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
FName HandSocketName;
@ -53,6 +55,8 @@ protected:
ECombatType CombatType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
TSubclassOf<UDamageType> DamageTypeClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
bool bCanBlock;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components")
TObjectPtr<class UCombatComponent> CombatComponent;

View File

@ -23,6 +23,7 @@ void UCombatAnimInstance::NativeInitializeAnimation()
{
CombatComponent->OnCombatToggled.AddUObject(this, &UCombatAnimInstance::UpdateCombatEnabled);
CombatComponent->OnBlockingSet.AddUObject(this, &UCombatAnimInstance::OnBlockingSet_Event);
CombatComponent->OnShieldEquippedSet.AddUObject(this, &UCombatAnimInstance::OnShieldSet_Event);
}
}
}
@ -59,3 +60,8 @@ void UCombatAnimInstance::OnBlockingSet_Event(bool bIsBlock)
{
IsBlocking = bIsBlock;
}
void UCombatAnimInstance::OnShieldSet_Event(bool bIsShieldEquipped)
{
IsShieldEquipped = bIsShieldEquipped;
}

View File

@ -26,6 +26,7 @@ public:
public: //Delegate
void UpdateCombatEnabled(bool combatEnabled);
void OnBlockingSet_Event(bool bIsBlock);
void OnShieldSet_Event(bool bIsShieldEquipped);
private:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="References", meta=(AllowPrivateAccess="true"))
@ -51,4 +52,6 @@ private:
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
bool IsBlocking;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
bool IsShieldEquipped;
};

View File

@ -1021,7 +1021,10 @@ bool ACombatPlayerCharacter::CanPerformBlock()
ReturnValue &= !StateManagerComponent->IsCurrentStateEqualToAny(inputContainer);
ReturnValue &= CombatComponent->GetCombatEnabled();
ReturnValue &= CombatComponent->GetShieldEquipped();
if(!IsValid(CombatComponent->GetMainWeapon()))
ReturnValue &= false;
else
ReturnValue &= CombatComponent->GetMainWeapon()->GetCanBlock();
ReturnValue &= bIsBlockPressed; //Block Key를 눌렀는가?
return ReturnValue;

View File

@ -8,6 +8,7 @@
DECLARE_MULTICAST_DELEGATE_OneParam(FOnCombatToggled, bool);
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBlockingSet, bool);
DECLARE_MULTICAST_DELEGATE_OneParam(FOnShieldEquippedSet, bool);
class ABaseWeapon;
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
@ -40,7 +41,11 @@ public:
void SetBlockingState(bool enableBlocking);
FORCEINLINE bool GetIsBlocking() { return bIsBlocking; }
FORCEINLINE void SetShieldEquipped(bool isEquipped) { bIsShieldEquipped = isEquipped; }
FORCEINLINE void SetShieldEquipped(bool isEquipped)
{
bIsShieldEquipped = isEquipped;
OnShieldEquippedSet.Broadcast(isEquipped);
}
FORCEINLINE bool GetShieldEquipped() { return bIsShieldEquipped; }
private:
@ -63,4 +68,5 @@ private:
public: //Delegate
FOnCombatToggled OnCombatToggled;
FOnBlockingSet OnBlockingSet;
FOnShieldEquippedSet OnShieldEquippedSet;
};