diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index d63a495..99bf825 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16d3c76e55c51d69133a001b7e0864d3b3453bf2414379215af36e3468f45f19 -size 72803 +oid sha256:586959609b1c6b9689865f104836b4dd866cce0cda9be700a33d0db3805e6a67 +size 72727 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index da73c16..543908c 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -65,6 +65,16 @@ void UHoldToInitCombat::OnRightClickDown() bRightClickDown = true; //InitCombatWidget->AddToViewport(); } + + if (GunEffect) + { + //Get Player Actor + const AActor* PlayerActor = GetWorld()->GetFirstPlayerController()->GetPawn(); + //Get Static Mesh Location on the player actor + const UStaticMeshComponent* GunComponent = Cast(PlayerActor->GetComponentsByTag(UPrimitiveComponent::StaticClass(), FName("Gun"))[0]); + const FVector GunLocationOffset = GunComponent->GetSocketTransform("Muzzle").TransformPosition(FVector(-100, 0, 0)); + UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), GunEffect, GunLocationOffset, PlayerActor->GetActorRotation()); + } } void UHoldToInitCombat::OnRightClickUp() diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h index 3cba925..c29c0ca 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h @@ -4,8 +4,11 @@ #include "CoreMinimal.h" #include "Components/ActorComponent.h" +#include "NiagaraComponent.h" +#include "NiagaraFunctionLibrary.h" #include "HoldToInitCombat.generated.h" +class UNiagaraSystem; UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) class THE_TWILIGHT_ABYSS_API UHoldToInitCombat : public UActorComponent @@ -20,6 +23,9 @@ public: UPROPERTY() TSubclassOf InitCombatWidgetClass; + UPROPERTY(EditDefaultsOnly) + UNiagaraSystem* GunEffect; + protected: // Called when the game starts virtual void BeginPlay() override;