[박치영] 소모품 아이템 Base 작업
parent
6f59d664d6
commit
9a33be5092
|
@ -151,4 +151,6 @@ ManualIPAddress=
|
||||||
+PropertyRedirects=(OldName="/Script/D1.MasterAI.RightWeaponCollisionComponent",NewName="/Script/D1.MasterAI.MainCollisionComponent")
|
+PropertyRedirects=(OldName="/Script/D1.MasterAI.RightWeaponCollisionComponent",NewName="/Script/D1.MasterAI.MainCollisionComponent")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.MasterAI.LeftWeaponCollisionComponent",NewName="/Script/D1.MasterAI.SubCollisionComponent")
|
+PropertyRedirects=(OldName="/Script/D1.MasterAI.LeftWeaponCollisionComponent",NewName="/Script/D1.MasterAI.SubCollisionComponent")
|
||||||
+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.EquippedItems",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipments")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Actor/BaseConsumable.h"
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Actor/BaseEquippable.h"
|
||||||
|
#include "BaseConsumable.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class D1_API ABaseConsumable : public ABaseEquippable
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
|
@ -61,4 +61,8 @@ bool ABaseEquippable::GetIsEquipped()
|
||||||
return bIsEquipped;
|
return bIsEquipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABaseEquippable::UseItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameplayTagAssetInterface.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "BaseEquippable.generated.h"
|
#include "BaseEquippable.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class D1_API ABaseEquippable : public AActor
|
class D1_API ABaseEquippable : public AActor, public IGameplayTagAssetInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -23,6 +24,12 @@ public:
|
||||||
virtual void OnUnequipped();
|
virtual void OnUnequipped();
|
||||||
virtual void SetIsEquipped(bool IsEquipped);
|
virtual void SetIsEquipped(bool IsEquipped);
|
||||||
virtual bool GetIsEquipped();
|
virtual bool GetIsEquipped();
|
||||||
|
virtual void UseItem();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Inherited via IGameplayTagAssetInterface
|
||||||
|
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = OwnedGameplayTags; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
|
||||||
TObjectPtr<class USceneComponent> DefaultSceneRoot;
|
TObjectPtr<class USceneComponent> DefaultSceneRoot;
|
||||||
|
@ -37,4 +44,7 @@ protected:
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
||||||
FName AttachSocketName;
|
FName AttachSocketName;
|
||||||
|
private:
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GameplayTags", meta = (AllowPrivateAccess = "true"))
|
||||||
|
FGameplayTagContainer OwnedGameplayTags;
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ void ACombatPlayerCharacter::BeginPlay()
|
||||||
FActorSpawnParameters spawnParam;
|
FActorSpawnParameters spawnParam;
|
||||||
spawnParam.Owner = this;
|
spawnParam.Owner = this;
|
||||||
spawnParam.Instigator = this;
|
spawnParam.Instigator = this;
|
||||||
for (auto Equipment : StartingEquipment)
|
for (auto Equipment : StartingEquipments)
|
||||||
{
|
{
|
||||||
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Equipment, &GetActorTransform(), spawnParam));
|
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Equipment, &GetActorTransform(), spawnParam));
|
||||||
if (SpawnItem)
|
if (SpawnItem)
|
||||||
|
@ -255,6 +255,9 @@ void ACombatPlayerCharacter::SetupPlayerInputComponent(class UInputComponent* Pl
|
||||||
//Block
|
//Block
|
||||||
EnhancedInputComponent->BindAction(BlockAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::Blocking);
|
EnhancedInputComponent->BindAction(BlockAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::Blocking);
|
||||||
EnhancedInputComponent->BindAction(BlockAction, ETriggerEvent::Completed, this, &ACombatPlayerCharacter::StopBlocking);
|
EnhancedInputComponent->BindAction(BlockAction, ETriggerEvent::Completed, this, &ACombatPlayerCharacter::StopBlocking);
|
||||||
|
|
||||||
|
//Use Item
|
||||||
|
EnhancedInputComponent->BindAction(UseItemAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::UseItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +365,25 @@ float ACombatPlayerCharacter::PerformAttack(FGameplayTag AttackType, int32 Attac
|
||||||
return attackDuration;
|
return attackDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ACombatPlayerCharacter::UseItemByTag(FGameplayTag ItemTag)
|
||||||
|
{
|
||||||
|
for (auto Item : EquippedItems)
|
||||||
|
{
|
||||||
|
if(IsValid(Item))
|
||||||
|
{
|
||||||
|
IGameplayTagAssetInterface* TagItem = Cast<IGameplayTagAssetInterface>(Item);
|
||||||
|
if(!TagItem)
|
||||||
|
continue;
|
||||||
|
if(TagItem->HasMatchingGameplayTag(ItemTag))
|
||||||
|
{
|
||||||
|
Item->UseItem();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ACombatPlayerCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
void ACombatPlayerCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
||||||
{
|
{
|
||||||
if (NewSpeedMode == MovementSpeedMode)
|
if (NewSpeedMode == MovementSpeedMode)
|
||||||
|
@ -557,6 +579,11 @@ void ACombatPlayerCharacter::StopBlocking(const FInputActionValue& Value)
|
||||||
CombatComponent->SetBlockingState(false);
|
CombatComponent->SetBlockingState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
||||||
{
|
{
|
||||||
if (FGameplayTag::EmptyTag == CharState)
|
if (FGameplayTag::EmptyTag == CharState)
|
||||||
|
|
|
@ -76,6 +76,9 @@ class ACombatPlayerCharacter : public ACharacter, public ICombatInterface, publi
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
UInputAction* BlockAction;
|
UInputAction* BlockAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
|
UInputAction* UseItemAction;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
float ChargeAttackTime;
|
float ChargeAttackTime;
|
||||||
|
@ -128,6 +131,7 @@ public:
|
||||||
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
||||||
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false);
|
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false);
|
||||||
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||||
|
virtual bool UseItemByTag(FGameplayTag ItemTag) override;
|
||||||
|
|
||||||
// Inherited via IGameplayTagAssetInterface
|
// Inherited via IGameplayTagAssetInterface
|
||||||
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = OwnedGameplayTags; }
|
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = OwnedGameplayTags; }
|
||||||
|
@ -152,6 +156,7 @@ protected:
|
||||||
void ToggleLockOn(const FInputActionValue& Value);
|
void ToggleLockOn(const FInputActionValue& Value);
|
||||||
void Blocking(const FInputActionValue& Value);
|
void Blocking(const FInputActionValue& Value);
|
||||||
void StopBlocking(const FInputActionValue& Value);
|
void StopBlocking(const FInputActionValue& Value);
|
||||||
|
void UseItem(const FInputActionValue& Value);
|
||||||
|
|
||||||
private://Delegate
|
private://Delegate
|
||||||
void CharacterStateBegin(FGameplayTag CharState);
|
void CharacterStateBegin(FGameplayTag CharState);
|
||||||
|
@ -206,11 +211,12 @@ public:
|
||||||
TObjectPtr<UStatsComponent> StatsComponent;
|
TObjectPtr<UStatsComponent> StatsComponent;
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
|
||||||
TObjectPtr<UTargetingComponent> TargetingComponent;
|
TObjectPtr<UTargetingComponent> TargetingComponent;
|
||||||
|
|
||||||
//TODO : 방패 착용 후 Toggle Event 시 Weapon의 소켓이 안바뀌는 버그
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Equipment", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Equipment", meta = (AllowPrivateAccess = "true"))
|
||||||
TArray<TSubclassOf<class ABaseEquippable>> StartingEquipment;
|
TArray<TSubclassOf<class ABaseEquippable>> StartingEquipments;
|
||||||
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Equipment", meta = (AllowPrivateAccess = "true"))
|
||||||
|
TArray<TObjectPtr<ABaseEquippable>> EquippedItems;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
||||||
FName PelvisBoneName;
|
FName PelvisBoneName;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
||||||
|
|
|
@ -14,3 +14,8 @@ float ICombatInterface::PerformAttack(FGameplayTag AttackType, int32 AttackIndex
|
||||||
{
|
{
|
||||||
return 0.f;
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ICombatInterface::UseItemByTag(FGameplayTag ItemTag)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag = FCombatGameplayTags::Get().Character_State_GeneralActionState, int32 MontageIndex = 0, bool bRandomIndex = false);
|
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag = FCombatGameplayTags::Get().Character_State_GeneralActionState, int32 MontageIndex = 0, bool bRandomIndex = false);
|
||||||
UFUNCTION(Category="CombatActions")
|
UFUNCTION(Category="CombatActions")
|
||||||
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||||
|
UFUNCTION(Category="CombatActions")
|
||||||
|
virtual bool UseItemByTag(FGameplayTag ItemTag);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue