[박치영] Shield 추가작업

main
PCYPC\pcy35 2023-11-14 20:53:41 +09:00
parent 1af7482513
commit 34180c0ebf
18 changed files with 65 additions and 12 deletions

View File

@ -150,4 +150,5 @@ ManualIPAddress=
+PropertyRedirects=(OldName="/Script/D1.MasterAI.MainWeaponCollisionComponent",NewName="/Script/D1.MasterAI.RightWeaponCollisionComponent")
+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.CombatPlayerCharacter.Weapon",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipment")

View File

@ -3,3 +3,34 @@
#include "Actor/BaseShield.h"
#include "Components/CollisionComponent.h"
#include "Components/CombatComponent.h"
#include "GameFramework/Character.h"
void ABaseShield::OnEquipped()
{
SetIsEquipped(true);
AActor* owner = GetOwner();
if (!owner)
return;
CombatComponent = owner->GetComponentByClass<UCombatComponent>();
CombatComponent->OnCombatToggled.BindUObject(this, &ABaseWeapon::ToggleWeaponCombat);
OwnerStateManager = owner->GetComponentByClass<UStateManagerComponent>();
if (CombatComponent->GetCombatEnabled())
AttachActor(HandSocketName);
else
AttachActor(AttachSocketName);
CombatComponent->SetShieldWeapon(this);
CollisionComponent->SetCollisionMeshComponent(GetItemMesh());
CollisionComponent->AddActorToIgnore(GetOwner());
}
void ABaseShield::OnUnequipped()
{
Super::OnUnequipped();
CombatComponent->SetShieldWeapon(nullptr);
}

View File

@ -13,5 +13,8 @@ UCLASS()
class D1_API ABaseShield : public ABaseWeapon
{
GENERATED_BODY()
public:
virtual void OnEquipped() override;
virtual void OnUnequipped() override;
};

View File

@ -55,7 +55,7 @@ void ABaseWeapon::OnEquipped()
OwnerStateManager = owner->GetComponentByClass<UStateManagerComponent>();
if (CombatComponent->GetCombatEnabled())
if (CombatComponent->GetCombatEnabled()) //TODO : 방패 착용 후 Toggle Event 시 Weapon의 소켓이 안바뀌는 버그
AttachActor(HandSocketName);
else
AttachActor(AttachSocketName);

View File

@ -24,7 +24,7 @@ public:
public:
//override
void OnEquipped() override;
virtual void OnEquipped() override;
public:
//Delegate

View File

@ -20,7 +20,10 @@ void UCombatAnimInstance::NativeInitializeAnimation()
UCombatComponent* CombatComponent = Character->GetComponentByClass<UCombatComponent>();
ensure(CombatComponent);
if(IsValid(CombatComponent))
{
CombatComponent->OnCombatToggled.BindUObject(this, &UCombatAnimInstance::UpdateCombatEnabled);
CombatComponent->OnBlockingSet.BindUObject(this, &UCombatAnimInstance::OnBlockingSet_Event);
}
}
}
@ -51,3 +54,8 @@ void UCombatAnimInstance::UpdateCombatEnabled(bool combatEnabled)
{
CombatEnabled = combatEnabled;
}
void UCombatAnimInstance::OnBlockingSet_Event(bool bIsBlock)
{
IsBlocking = bIsBlock;
}

View File

@ -25,7 +25,8 @@ public:
public: //Delegate
void UpdateCombatEnabled(bool combatEnabled);
void OnBlockingSet_Event(bool bIsBlock);
private:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="References", meta=(AllowPrivateAccess="true"))
TObjectPtr<class ACharacter> Character;
@ -47,4 +48,7 @@ private:
ECombatType CombatType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
bool CombatEnabled;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
bool IsBlocking;
};

View File

@ -124,9 +124,12 @@ void ACombatPlayerCharacter::BeginPlay()
FActorSpawnParameters spawnParam;
spawnParam.Owner = this;
spawnParam.Instigator = this;
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Weapon, &GetActorTransform(), spawnParam));
if (SpawnItem)
SpawnItem->OnEquipped();
for (auto Equipment : StartingEquipment)
{
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Equipment, &GetActorTransform(), spawnParam));
if (SpawnItem)
SpawnItem->OnEquipped();
}
//Setting Timeline - if you set on Constructor, Can not get Curve
FOnTimelineFloat TimelineFloatCallback;
@ -945,6 +948,8 @@ bool ACombatPlayerCharacter::CanPerformBlock()
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_GeneralActionState);
ReturnValue &= !StateManagerComponent->IsCurrentStateEqualToAny(inputContainer);
ReturnValue &= CombatComponent->GetCombatEnabled();
ReturnValue &= IsValid(CombatComponent->GetShieldWeapon());
return ReturnValue;
}

View File

@ -203,9 +203,10 @@ public:
TObjectPtr<UStatsComponent> StatsComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
TObjectPtr<UTargetingComponent> TargetingComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon", meta = (AllowPrivateAccess = "true"))
TSubclassOf<class ABaseEquippable> Weapon;
//TODO : 방패 착용 후 Toggle Event 시 Weapon의 소켓이 안바뀌는 버그
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Equipment", meta = (AllowPrivateAccess = "true"))
TArray<TSubclassOf<class ABaseEquippable>> StartingEquipment;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
FName PelvisBoneName;

View File

@ -57,7 +57,7 @@ void UCombatComponent::SetBlockingState(bool enableBlocking)
if(enableBlocking != bIsBlocking)
{
bIsBlocking = enableBlocking;
OnBlockingSet.Execute(bIsBlocking);
}
onBlockingSet.Execute(bIsBlocking); // TODO : 이거 맞나?
}

View File

@ -62,5 +62,5 @@ private:
public: //Delegate
FOnCombatToggled OnCombatToggled;
FOnBlockingSet onBlockingSet;
FOnBlockingSet OnBlockingSet;
};