[박치영] Shield 추가작업
parent
1af7482513
commit
34180c0ebf
|
@ -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")
|
||||
|
||||
|
|
Binary file not shown.
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,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);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,7 @@ class D1_API ABaseShield : public ABaseWeapon
|
|||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void OnEquipped() override;
|
||||
virtual void OnUnequipped() override;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
//override
|
||||
void OnEquipped() override;
|
||||
virtual void OnEquipped() override;
|
||||
|
||||
public:
|
||||
//Delegate
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
|
||||
public: //Delegate
|
||||
void UpdateCombatEnabled(bool combatEnabled);
|
||||
void OnBlockingSet_Event(bool bIsBlock);
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="References", meta=(AllowPrivateAccess="true"))
|
||||
|
@ -47,4 +48,7 @@ private:
|
|||
ECombatType CombatType;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
|
||||
bool CombatEnabled;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
|
||||
bool IsBlocking;
|
||||
};
|
||||
|
|
|
@ -124,9 +124,12 @@ void ACombatPlayerCharacter::BeginPlay()
|
|||
FActorSpawnParameters spawnParam;
|
||||
spawnParam.Owner = this;
|
||||
spawnParam.Instigator = this;
|
||||
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Weapon, &GetActorTransform(), spawnParam));
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -204,8 +204,9 @@ public:
|
|||
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;
|
||||
|
|
|
@ -57,7 +57,7 @@ void UCombatComponent::SetBlockingState(bool enableBlocking)
|
|||
if(enableBlocking != bIsBlocking)
|
||||
{
|
||||
bIsBlocking = enableBlocking;
|
||||
OnBlockingSet.Execute(bIsBlocking);
|
||||
}
|
||||
onBlockingSet.Execute(bIsBlocking); // TODO : 이거 맞나?
|
||||
}
|
||||
|
||||
|
|
|
@ -62,5 +62,5 @@ private:
|
|||
|
||||
public: //Delegate
|
||||
FOnCombatToggled OnCombatToggled;
|
||||
FOnBlockingSet onBlockingSet;
|
||||
FOnBlockingSet OnBlockingSet;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue