[박치영] 포션 작업 1
parent
9a33be5092
commit
0ab073bd22
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,3 +3,19 @@
|
|||
|
||||
#include "Actor/BaseConsumable.h"
|
||||
|
||||
#include "Interface/CombatInterface.h"
|
||||
|
||||
ABaseConsumable::ABaseConsumable()
|
||||
{
|
||||
//Settings OwnedGameplayTags
|
||||
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
||||
}
|
||||
|
||||
void ABaseConsumable::UseItem()
|
||||
{
|
||||
ICombatInterface* ActionObjects = Cast<ICombatInterface>(GetOwner());
|
||||
if(!ActionObjects)
|
||||
return;
|
||||
|
||||
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
||||
}
|
||||
|
|
|
@ -13,5 +13,12 @@ UCLASS()
|
|||
class D1_API ABaseConsumable : public ABaseEquippable
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ABaseConsumable();
|
||||
public:
|
||||
virtual void UseItem() override;
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<UAnimMontage> UseItemMontage;
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
||||
FName AttachSocketName;
|
||||
private:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GameplayTags", meta = (AllowPrivateAccess = "true"))
|
||||
FGameplayTagContainer OwnedGameplayTags;
|
||||
};
|
||||
|
|
|
@ -128,7 +128,10 @@ void ACombatPlayerCharacter::BeginPlay()
|
|||
{
|
||||
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Equipment, &GetActorTransform(), spawnParam));
|
||||
if (SpawnItem)
|
||||
{
|
||||
SpawnItem->OnEquipped();
|
||||
EquippedItems.Add(SpawnItem);
|
||||
}
|
||||
}
|
||||
|
||||
//Setting Timeline - if you set on Constructor, Can not get Curve
|
||||
|
@ -365,6 +368,27 @@ float ACombatPlayerCharacter::PerformAttack(FGameplayTag AttackType, int32 Attac
|
|||
return attackDuration;
|
||||
}
|
||||
|
||||
bool ACombatPlayerCharacter::PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate, bool bAutoReset)
|
||||
{
|
||||
|
||||
UAnimMontage* actionMontage = InMontage;
|
||||
if (IsValid(actionMontage))
|
||||
{
|
||||
StateManagerComponent->SetCurrentState(StateTag);
|
||||
StateManagerComponent->SetCurrentAction(ActionTag);
|
||||
if(!IsValid(GetMesh()->GetAnimInstance()))
|
||||
return false;
|
||||
GetMesh()->GetAnimInstance()->Montage_Play(actionMontage, fMontagePlayRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
FString str = FString::Printf(TEXT("PerformCustomAction is NOT VALID!!"));
|
||||
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Red, str);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ACombatPlayerCharacter::UseItemByTag(FGameplayTag ItemTag)
|
||||
{
|
||||
for (auto Item : EquippedItems)
|
||||
|
@ -581,7 +605,7 @@ void ACombatPlayerCharacter::StopBlocking(const FInputActionValue& Value)
|
|||
|
||||
void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value)
|
||||
{
|
||||
|
||||
UseItemByTag(FCombatGameplayTags::Get().Item_Consumable);
|
||||
}
|
||||
|
||||
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
||||
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false);
|
||||
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||
virtual bool PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate, bool bAutoReset) override;
|
||||
virtual bool UseItemByTag(FGameplayTag ItemTag) override;
|
||||
|
||||
// Inherited via IGameplayTagAssetInterface
|
||||
|
|
|
@ -53,7 +53,10 @@ public:
|
|||
void InitializeStats();
|
||||
void SetCurrentStatValue(EStats stat, float value);
|
||||
float GetCurrentStatValue(EStats stat);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ModifyCurrentStatValue(EStats stat, float value, bool bShouldRegenerate = true);
|
||||
|
||||
void TakeDamageOnStat(float inDamage);
|
||||
void StartRegen(EStats statType);
|
||||
void AfterDelayExecuteRegenStamina();
|
||||
|
|
|
@ -129,4 +129,24 @@ void FCombatGameplayTags::InitializeNativeGameplayTags()
|
|||
FName("Character.Action.Attack.Blocking"),
|
||||
FString("Action Attack Blocking")
|
||||
);
|
||||
|
||||
GameplayTags.Character_Action_Attack_UseItem = UGameplayTagsManager::Get().AddNativeGameplayTag(
|
||||
FName("Character.Action.Attack.UseItem"),
|
||||
FString("Action Attack UseItem")
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Item
|
||||
*/
|
||||
|
||||
GameplayTags.Item_Consumable = UGameplayTagsManager::Get().AddNativeGameplayTag(
|
||||
FName("Item.Consumable"),
|
||||
FString("Item Consumable")
|
||||
);
|
||||
|
||||
GameplayTags.Item_Consumable_Potion = UGameplayTagsManager::Get().AddNativeGameplayTag(
|
||||
FName("Item.Consumable.Potion"),
|
||||
FString("Item Consumable Potion")
|
||||
);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ public:
|
|||
FGameplayTag Character_Action_Attack_MediumRange;
|
||||
FGameplayTag Character_Action_Attack_RareAttack;
|
||||
FGameplayTag Character_Action_Attack_Blocking;
|
||||
FGameplayTag Character_Action_Attack_UseItem;
|
||||
|
||||
//Item
|
||||
FGameplayTag Item_Consumable;
|
||||
FGameplayTag Item_Consumable_Potion;
|
||||
|
||||
private:
|
||||
static FCombatGameplayTags GameplayTags;
|
||||
|
|
|
@ -15,6 +15,12 @@ float ICombatInterface::PerformAttack(FGameplayTag AttackType, int32 AttackIndex
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
bool ICombatInterface::PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage,
|
||||
float fMontagePlayRate, bool bAutoReset)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ICombatInterface::UseItemByTag(FGameplayTag ItemTag)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
UFUNCTION(Category="CombatActions")
|
||||
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||
UFUNCTION(Category="CombatActions")
|
||||
virtual bool PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate = 1.f, bool bAutoReset = false);
|
||||
UFUNCTION(Category="CombatActions")
|
||||
virtual bool UseItemByTag(FGameplayTag ItemTag);
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue