[박치영] 포션 개수제한 기능 추가
parent
0ab073bd22
commit
1bc4df3e52
|
@ -153,4 +153,6 @@ ManualIPAddress=
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.Weapon",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipment")
|
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.Weapon",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipment")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.StartingEquipment",NewName="/Script/D1.CombatPlayerCharacter.EquippedItems")
|
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.StartingEquipment",NewName="/Script/D1.CombatPlayerCharacter.EquippedItems")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.EquippedItems",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipments")
|
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.EquippedItems",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipments")
|
||||||
|
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
||||||
|
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -7,15 +7,23 @@
|
||||||
|
|
||||||
ABaseConsumable::ABaseConsumable()
|
ABaseConsumable::ABaseConsumable()
|
||||||
{
|
{
|
||||||
|
//초기화 구문
|
||||||
|
MaxNumberOfUses = 3;
|
||||||
|
CurrentNumberOfUses = 0;
|
||||||
|
|
||||||
//Settings OwnedGameplayTags
|
//Settings OwnedGameplayTags
|
||||||
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABaseConsumable::UseItem()
|
void ABaseConsumable::UseItem()
|
||||||
{
|
{
|
||||||
|
if(MaxNumberOfUses < CurrentNumberOfUses)
|
||||||
|
return;
|
||||||
|
|
||||||
ICombatInterface* ActionObjects = Cast<ICombatInterface>(GetOwner());
|
ICombatInterface* ActionObjects = Cast<ICombatInterface>(GetOwner());
|
||||||
if(!ActionObjects)
|
if(!ActionObjects)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
||||||
|
CurrentNumberOfUses++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,9 @@ public:
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||||
TObjectPtr<UAnimMontage> UseItemMontage;
|
TObjectPtr<UAnimMontage> UseItemMontage;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||||
|
int32 CurrentNumberOfUses;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||||
|
int32 MaxNumberOfUses;
|
||||||
};
|
};
|
||||||
|
|
|
@ -605,7 +605,8 @@ void ACombatPlayerCharacter::StopBlocking(const FInputActionValue& Value)
|
||||||
|
|
||||||
void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
UseItemByTag(FCombatGameplayTags::Get().Item_Consumable);
|
if(CanUseItem())
|
||||||
|
UseItemByTag(FCombatGameplayTags::Get().Item_Consumable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
||||||
|
@ -1042,6 +1043,23 @@ bool ACombatPlayerCharacter::CanPerformBlock()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ACombatPlayerCharacter::CanUseItem()
|
||||||
|
{
|
||||||
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
FGameplayTagContainer inputContainer;
|
||||||
|
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Attacking);
|
||||||
|
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Dodging);
|
||||||
|
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Dead);
|
||||||
|
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Disable);
|
||||||
|
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_GeneralActionState);
|
||||||
|
|
||||||
|
ReturnValue &= !StateManagerComponent->IsCurrentStateEqualToAny(inputContainer);
|
||||||
|
ReturnValue &= (StatsComponent->GetCurrentStatValue(EStats::Stamina) >= 10.f);
|
||||||
|
|
||||||
|
return ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
FGameplayTag ACombatPlayerCharacter::GetDesiredAttackType()
|
FGameplayTag ACombatPlayerCharacter::GetDesiredAttackType()
|
||||||
{
|
{
|
||||||
if (GetCharacterMovement()->IsFalling())
|
if (GetCharacterMovement()->IsFalling())
|
||||||
|
|
|
@ -200,6 +200,7 @@ protected: //Check Func
|
||||||
bool CanReceiveHitReaction();
|
bool CanReceiveHitReaction();
|
||||||
bool CanPerformSprint();
|
bool CanPerformSprint();
|
||||||
bool CanPerformBlock();
|
bool CanPerformBlock();
|
||||||
|
bool CanUseItem();
|
||||||
FGameplayTag GetDesiredAttackType();
|
FGameplayTag GetDesiredAttackType();
|
||||||
bool WasHitBlocked();
|
bool WasHitBlocked();
|
||||||
|
|
||||||
|
|
|
@ -20,3 +20,9 @@ void ACombatHUD::BeginPlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACombatHUD::UpdateHealthPotionAmount()
|
||||||
|
{
|
||||||
|
if(!IsValid(MainUI))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ class D1_API ACombatHUD : public AHUD
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
public:
|
||||||
|
void UpdateHealthPotionAmount();
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditDefaultsOnly, Category = UI)
|
UPROPERTY(EditDefaultsOnly, Category = UI)
|
||||||
TSubclassOf<class UUI_MainHUD> MainUI;
|
TSubclassOf<class UUI_MainHUD> MainUI;
|
||||||
|
|
Loading…
Reference in New Issue