From 5743e885e0135bd06cf73bc38bb58707019a650c Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 2 Oct 2023 13:36:19 +0100 Subject: [PATCH 01/26] Basic Shooting functionality fixed Shooting now shoots a ray out and detects what object is being hit --- .../Blueprints/BP_FirstPersonCharacter.uasset | 4 +- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../BaseWeapons/BP_BaseWeapon.uasset | 4 +- .../Architecture/Floor_400x400.uasset | 4 +- .../StarterContent/Audio/Collapse01.uasset | 4 +- .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 2 +- .../BountySystem/BountyClass.h | 2 +- .../EndlessVendettaCharacter.cpp | 131 +++--------------- .../EndlessVendettaCharacter.h | 5 +- .../WeaponSystem/BaseWeaponClass.cpp | 33 ++--- .../WeaponSystem/BaseWeaponClass.h | 8 +- 11 files changed, 57 insertions(+), 144 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 68a7823a..fda783bd 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:072d87c768407249e6e50f7b87ab9a88392c17cf82c72934e3c947e2943210bb -size 26284 +oid sha256:d580d82ff6abdbebffa1e57dc264fb6e4b0e6c53e28aa0c853b56149f7867471 +size 27305 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 50209cd2..52b41107 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b311799aa263b7af6d3eb738da33d39b0d40d7883bf0a4e3cb6024e06157cec -size 37724 +oid sha256:21afd371e599a3fb2c37e3662406978c3305c602a1c77bb3717e9bc4f2514b48 +size 35926 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index 0aef22ed..063848e3 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a4dfbc572d0f67be5a3c6898946ce7fce2895174236407ce9910f99c59690367 -size 28778 +oid sha256:51cc0f9f0adae065e9941acdd88abe2fe5f7015a3a5343a63f7b0507e90c21ed +size 28900 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..ec9ee977 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:d4e6c0e1dad79feeaa5078889de9cf4c6753f1e77cf7d17a3eb3de082b91d4ae +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset b/EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset index 198f128d..5e3ff30e 100644 --- a/EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset +++ b/EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43d44b5a53fbbfc62522f67ad9523360b15677e3d0caeea96f4d9d0580a013cd -size 353935 +oid sha256:85c827023ee4b466228ec65e92b4b4a0415a106de041ac1c2cab481a2a5dfa8d +size 348532 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset index 4f6bab25..4777b0ad 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdab805d14a7bc4f2fa61abc0106161cf2626e8857ae14089d5e4c93f9a320d6 +oid sha256:5b8b34286278ebb69adb37de9d922ea859ecab2e2547f7e3a634d75c61522828 size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h index 9dfb87e1..4f65bae9 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -7,7 +7,7 @@ #include "GameFramework/Actor.h" #include "BountyClass.generated.h" -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedFirstCheckpoint) +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedFirstCheckpoint); UCLASS() class ENDLESSVENDETTA_API ABountyClass : public AActor diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 448d805c..ace56207 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -59,7 +59,7 @@ void AEndlessVendettaCharacter::BeginPlay() GadgetManager->SpawnGadgets(Cast(PlayersCamera)); break; } - + } //////////////////////////////////////////////////////////////////////////// Input @@ -82,13 +82,14 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* // Gadget Toggling EnhancedInputComponent->BindAction(ReconAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::ToggleRecon); EnhancedInputComponent->BindAction(CombatAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::ToggleCombat); - + //Weapon Switching EnhancedInputComponent->BindAction(EquipPrimaryWeapon, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::EquipPrimary); EnhancedInputComponent->BindAction(EquipSecondaryWeapon, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::EquipSecondary); //Weapon Shooting EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); + EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); } } @@ -145,12 +146,10 @@ void AEndlessVendettaCharacter::EquipPrimary() } if (IsValid(SecondaryWeapon)) EquipSecondary(); - - // Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;///////////////////////// - if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;/////////////////////// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return; + if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return; + FActorSpawnParameters spawnParams; spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; @@ -163,131 +162,47 @@ void AEndlessVendettaCharacter::EquipPrimary() //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor PrimaryWeapon = Cast(PrimaryWeaponActor); - - //If primary weapon is not there but secondary weapon is it will call equipSecondary. - //EquipSecondary checks and sees that secondary is there so it will call to destroy itself - //Code goes back and sees primary weapon is not there anymore and spawns it in. - //Same thing for the EquipSecondary() - - // if (!IsValid(PrimaryWeapon)) - // { - // if (IsValid(SecondaryWeapon)) EquipSecondary(); - // - // UE_LOG(LogTemp, Display, TEXT("Primary equipped")); - // bHasRifle = true; - // FActorSpawnParameters spawnParams; - // spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - // FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - // //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass - // AActor* PrimaryWeaponActor = GetWorld()->SpawnActor(PrimaryWeaponClass, spawnParams); - // PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); - // //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object - // //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor - // PrimaryWeapon = Cast(PrimaryWeaponActor); - // - // } - // else if (IsValid(PrimaryWeapon)) - // { - // PrimaryWeapon->Destroy(); - // bHasRifle = false; - // } } void AEndlessVendettaCharacter::EquipSecondary() { if (IsValid(SecondaryWeapon)) - { - SecondaryWeapon->Destroy(); + { + SecondaryWeapon->Destroy(); SecondaryWeapon = nullptr; - bHasRifle = false; - return; - } + bHasRifle = false; + return; + } if (IsValid(PrimaryWeapon)) EquipPrimary(); - - // Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;///////////////////////// - if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;/////////////////////// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return; + if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return; + FActorSpawnParameters spawnParams; spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - + bHasRifle = true; AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); SecondaryWeapon = Cast(SecondaryWeaponActor); - - // if (!IsValid(SecondaryWeapon)) - // { - // if (IsValid(PrimaryWeapon)) EquipPrimary(); - // - // UE_LOG(LogTemp, Display, TEXT("Secondary equipped")); - // bHasRifle = true; - // FActorSpawnParameters spawnParams; - // spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - // FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - // AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); - // SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); - // SecondaryWeapon = Cast(SecondaryWeaponActor); - // } - // else if (IsValid(SecondaryWeapon)) - // { - // SecondaryWeapon->Destroy(); - // bHasRifle = false; - // } - + + } //Calls the fire function in the baseWeaponClass void AEndlessVendettaCharacter::TapFireCaller() { UE_LOG(LogTemp, Warning, TEXT("Tap Fire")); - // if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) - // { - // PrimaryWeaponClass.GetDefaultObject()->TapFire(); - // } + if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + { + PrimaryWeapon->TapFire(); + } } -//POTENTIAL PICKUP SYSTEM NEEDS CHANGING BUT YES - -//Called from Player BluePrints -/*void AEndlessVendettaCharacter::WeaponPickUpSystem(AActor* PickedUpWeapon) -{ - ABaseWeaponClass* WeaponInWorld = Cast(PickedUpWeapon); - if(WeaponInWorld->IsA(ABaseWeaponClass::StaticClass())) - { - if(PrimaryWeapon) - { - UE_LOG(LogTemp, Display, TEXT("Primary Weapon Picked up")); - bHasRifle = true; - FVector loc = GetActorLocation() + FVector(-50, 0, 0); - FRotator rot = GetActorRotation(); - FActorSpawnParameters spawnParams; - spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - //WeaponInWorld = Cast(GetWorld()->SpawnActor(PrimaryWeapon, loc, rot, spawnParams)); - WeaponInWorld->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); - WeaponInWorld->Destroy(); - - //for some reason the spawning of the weapon is broken to the players hand so need to fix this. - - // potentially add a varibable to check if its a secondary or priamry weapon being picked up - // add this in the baseweaponclass variable - } - } - if(WeaponInWorld->IsA(ABaseWeaponClass::StaticClass())) - { - if(SecondaryWeapon) - { - UE_LOG(LogTemp, Display, TEXT("Secondary Weapon Picked up")); - - } - } -}*/ void AEndlessVendettaCharacter::Move(const FInputActionValue& Value) diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index cf41bef6..20681db6 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -103,7 +103,6 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void TapFireCaller(); - protected: /** Called for movement input */ void Move(const FInputActionValue& Value); @@ -119,9 +118,6 @@ protected: void EquipSecondary(); - //Called from Player BluePrints - //UFUNCTION(BlueprintCallable, Category = "Weapons") - //void WeaponPickUpSystem(AActor* PickedUpWeapon); protected: // APawn interface @@ -133,6 +129,7 @@ public: USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; } /** Returns FirstPersonCameraComponent subobject **/ UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; } + }; diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 0d14f19d..89e02d0a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -22,21 +22,13 @@ void ABaseWeaponClass::BeginPlay() // Attempt to find the player character APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0); player = Cast(PlayerController->GetCharacter()); - if (PlayerController) + + for (UActorComponent* actorComp : player->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart"))) { - if (player) - { - UE_LOG(LogTemp, Display, TEXT("BeginPlay: Player found.")); - } - else - { - UE_LOG(LogTemp, Error, TEXT("BeginPlay: Player not found.")); - } - } - else - { - UE_LOG(LogTemp, Error, TEXT("BeginPlay: Player controller not found.")); + GunStartArrow = Cast(actorComp); + break; } + } // Called every frame @@ -47,20 +39,23 @@ void ABaseWeaponClass::Tick(float DeltaTime) void ABaseWeaponClass::TapFire() { + FTimerHandle timerHandle; FHitResult outHit; FVector traceStart; FVector traceEnd; - traceStart = player->GetActorLocation(); - traceEnd = traceStart + (player->GetActorForwardVector() * 50); - UE_LOG(LogTemp, Display, TEXT("World: %s"), *GetWorld()->GetName()); + traceStart = GunStartArrow->GetComponentLocation(); + traceEnd = traceStart + (player->GetActorForwardVector() * BulletDistance); FCollisionQueryParams collisionParams; + collisionParams.AddIgnoredActor(player); + collisionParams.AddIgnoredActor(this); + GetWorldTimerManager().SetTimer(timerHandle, 1 / FireRate, false, 1.0f); GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); //Debug line to see where the trace hit - DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true); + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); if (outHit.bBlockingHit) { - UE_LOG(LogTemp, Display, TEXT("Hit something")); + UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); + } - UE_LOG(LogTemp, Display, TEXT("BOOMBOOMBIMBAMBIM")); } diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 2fc1219a..149d45d5 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "WeaponItemClass.h" +#include "Components/ArrowComponent.h" #include "BaseWeaponClass.generated.h" class AEndlessVendettaCharacter; @@ -47,7 +48,12 @@ public: UPROPERTY(VisibleAnywhere) ACharacter* player; - +private: + + UArrowComponent* GunStartArrow; + + UPROPERTY(EditAnywhere) + float BulletDistance; //Add HoldFire functionality after pistol is complete for holding fire for pistol and make it start spraying innacuratly. From f0ac65acb8228a6a7e7c0f6f9dd60923761cc4b1 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 2 Oct 2023 14:27:47 +0100 Subject: [PATCH 02/26] Updated GunShooting to fix grabbing forward vector of guncomp --- .../Blueprints/BP_FirstPersonCharacter.uasset | 2 +- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../BaseWeapons/BP_BaseWeapon.uasset | 4 +- .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 2 +- .../EndlessVendettaCharacter.cpp | 25 ++++++++++-- .../EndlessVendettaCharacter.h | 5 +++ .../WeaponSystem/BaseWeaponClass.cpp | 39 +++++++++++++++++-- .../WeaponSystem/BaseWeaponClass.h | 12 ++++++ 8 files changed, 81 insertions(+), 12 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index fda783bd..7d416e94 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d580d82ff6abdbebffa1e57dc264fb6e4b0e6c53e28aa0c853b56149f7867471 +oid sha256:00e38eda0524fe228dc71f14ef9f96ebec3f8142ffaeca9366f253a7456d529b size 27305 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 52b41107..998ce21b 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21afd371e599a3fb2c37e3662406978c3305c602a1c77bb3717e9bc4f2514b48 -size 35926 +oid sha256:6c3599c78d84a6895d06de8ce3697a6aefd517ac0105d041cab6f5124090bb3b +size 35834 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index 063848e3..f09d81f5 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51cc0f9f0adae065e9941acdd88abe2fe5f7015a3a5343a63f7b0507e90c21ed -size 28900 +oid sha256:694f084a31b369305b9cf0e066786a624f73721bf819d3823177703341f0b98c +size 28902 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset index 4777b0ad..b70bdb74 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b8b34286278ebb69adb37de9d922ea859ecab2e2547f7e3a634d75c61522828 +oid sha256:51fdff374c4c25c321646b9315bc5286b1ddc89511a597538bf96bea96222e02 size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index ace56207..5a08ac16 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -89,7 +89,8 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* //Weapon Shooting EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); - EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); + EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::HoldFireCaller); + //EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::CancelFire); } } @@ -197,10 +198,28 @@ void AEndlessVendettaCharacter::EquipSecondary() void AEndlessVendettaCharacter::TapFireCaller() { UE_LOG(LogTemp, Warning, TEXT("Tap Fire")); - if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + if (IsValid(PrimaryWeapon)) { - PrimaryWeapon->TapFire(); + PrimaryWeapon->TapFire(); } + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->TapFire(); + } +} + +void AEndlessVendettaCharacter::HoldFireCaller() +{ + UE_LOG(LogTemp, Warning, TEXT("Hold Fire")); + if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + { + PrimaryWeapon->HoldFire(); + } +} + +void AEndlessVendettaCharacter::CancelFire() +{ + PrimaryWeapon->CancelFire(); } diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 20681db6..837ae1d4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -103,6 +103,11 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void TapFireCaller(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void HoldFireCaller(); + + void CancelFire(); + protected: /** Called for movement input */ void Move(const FInputActionValue& Value); diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 89e02d0a..102ddcf9 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -37,9 +37,44 @@ void ABaseWeaponClass::Tick(float DeltaTime) Super::Tick(DeltaTime); } +void ABaseWeaponClass::ClickDetectionTimer() +{ + if (GetWorldTimerManager().IsTimerActive(timerHandle)) + { + return; + } + GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::TapFire, 1 / FireRate, false); + + +} + +void ABaseWeaponClass::CancelFire() +{ + GetWorldTimerManager().ClearTimer(timerHandle); +} + void ABaseWeaponClass::TapFire() { - FTimerHandle timerHandle; + FHitResult outHit; + FVector traceStart; + FVector traceEnd; + traceStart = GunStartArrow->GetComponentLocation(); + traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); + FCollisionQueryParams collisionParams; + collisionParams.AddIgnoredActor(player); + collisionParams.AddIgnoredActor(this); + GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); + + //Debug line to see where the trace hit + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); + if (outHit.bBlockingHit) + { + UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); + } +} + +void ABaseWeaponClass::HoldFire() +{ FHitResult outHit; FVector traceStart; FVector traceEnd; @@ -48,7 +83,6 @@ void ABaseWeaponClass::TapFire() FCollisionQueryParams collisionParams; collisionParams.AddIgnoredActor(player); collisionParams.AddIgnoredActor(this); - GetWorldTimerManager().SetTimer(timerHandle, 1 / FireRate, false, 1.0f); GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); //Debug line to see where the trace hit @@ -56,6 +90,5 @@ void ABaseWeaponClass::TapFire() if (outHit.bBlockingHit) { UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); - } } diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 149d45d5..903e46ff 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -45,9 +45,21 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void TapFire(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void HoldFire(); + + UFUNCTION(BlueprintCallable, Category = "Weapons") + void ClickDetectionTimer(); + + void CancelFire(); + UPROPERTY(VisibleAnywhere) ACharacter* player; + FTimerHandle timerHandle; + + bool bFirstBulletShot = false; + private: UArrowComponent* GunStartArrow; From fed24de414435dd74c360004cb59111b8c5d29be Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 2 Oct 2023 14:27:47 +0100 Subject: [PATCH 03/26] Updated GunShooting to fix grabbing forward vector of guncomp --- .../Blueprints/BP_FirstPersonCharacter.uasset | 2 +- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../BaseWeapons/BP_BaseWeapon.uasset | 4 +- .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 2 +- .../EndlessVendettaCharacter.cpp | 25 ++++++++++-- .../EndlessVendettaCharacter.h | 5 +++ .../WeaponSystem/BaseWeaponClass.cpp | 39 +++++++++++++++++-- .../WeaponSystem/BaseWeaponClass.h | 12 ++++++ 8 files changed, 81 insertions(+), 12 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index fda783bd..7d416e94 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d580d82ff6abdbebffa1e57dc264fb6e4b0e6c53e28aa0c853b56149f7867471 +oid sha256:00e38eda0524fe228dc71f14ef9f96ebec3f8142ffaeca9366f253a7456d529b size 27305 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 52b41107..998ce21b 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21afd371e599a3fb2c37e3662406978c3305c602a1c77bb3717e9bc4f2514b48 -size 35926 +oid sha256:6c3599c78d84a6895d06de8ce3697a6aefd517ac0105d041cab6f5124090bb3b +size 35834 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index 063848e3..f09d81f5 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51cc0f9f0adae065e9941acdd88abe2fe5f7015a3a5343a63f7b0507e90c21ed -size 28900 +oid sha256:694f084a31b369305b9cf0e066786a624f73721bf819d3823177703341f0b98c +size 28902 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset index 4777b0ad..b70bdb74 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b8b34286278ebb69adb37de9d922ea859ecab2e2547f7e3a634d75c61522828 +oid sha256:51fdff374c4c25c321646b9315bc5286b1ddc89511a597538bf96bea96222e02 size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index ace56207..5a08ac16 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -89,7 +89,8 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* //Weapon Shooting EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); - EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); + EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::HoldFireCaller); + //EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::CancelFire); } } @@ -197,10 +198,28 @@ void AEndlessVendettaCharacter::EquipSecondary() void AEndlessVendettaCharacter::TapFireCaller() { UE_LOG(LogTemp, Warning, TEXT("Tap Fire")); - if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + if (IsValid(PrimaryWeapon)) { - PrimaryWeapon->TapFire(); + PrimaryWeapon->TapFire(); } + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->TapFire(); + } +} + +void AEndlessVendettaCharacter::HoldFireCaller() +{ + UE_LOG(LogTemp, Warning, TEXT("Hold Fire")); + if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + { + PrimaryWeapon->HoldFire(); + } +} + +void AEndlessVendettaCharacter::CancelFire() +{ + PrimaryWeapon->CancelFire(); } diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 20681db6..837ae1d4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -103,6 +103,11 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void TapFireCaller(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void HoldFireCaller(); + + void CancelFire(); + protected: /** Called for movement input */ void Move(const FInputActionValue& Value); diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 89e02d0a..102ddcf9 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -37,9 +37,44 @@ void ABaseWeaponClass::Tick(float DeltaTime) Super::Tick(DeltaTime); } +void ABaseWeaponClass::ClickDetectionTimer() +{ + if (GetWorldTimerManager().IsTimerActive(timerHandle)) + { + return; + } + GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::TapFire, 1 / FireRate, false); + + +} + +void ABaseWeaponClass::CancelFire() +{ + GetWorldTimerManager().ClearTimer(timerHandle); +} + void ABaseWeaponClass::TapFire() { - FTimerHandle timerHandle; + FHitResult outHit; + FVector traceStart; + FVector traceEnd; + traceStart = GunStartArrow->GetComponentLocation(); + traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); + FCollisionQueryParams collisionParams; + collisionParams.AddIgnoredActor(player); + collisionParams.AddIgnoredActor(this); + GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); + + //Debug line to see where the trace hit + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); + if (outHit.bBlockingHit) + { + UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); + } +} + +void ABaseWeaponClass::HoldFire() +{ FHitResult outHit; FVector traceStart; FVector traceEnd; @@ -48,7 +83,6 @@ void ABaseWeaponClass::TapFire() FCollisionQueryParams collisionParams; collisionParams.AddIgnoredActor(player); collisionParams.AddIgnoredActor(this); - GetWorldTimerManager().SetTimer(timerHandle, 1 / FireRate, false, 1.0f); GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); //Debug line to see where the trace hit @@ -56,6 +90,5 @@ void ABaseWeaponClass::TapFire() if (outHit.bBlockingHit) { UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); - } } diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 149d45d5..903e46ff 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -45,9 +45,21 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void TapFire(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void HoldFire(); + + UFUNCTION(BlueprintCallable, Category = "Weapons") + void ClickDetectionTimer(); + + void CancelFire(); + UPROPERTY(VisibleAnywhere) ACharacter* player; + FTimerHandle timerHandle; + + bool bFirstBulletShot = false; + private: UArrowComponent* GunStartArrow; From 93447bde97c6696f4e54888f52aed2488b729cc7 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 2 Oct 2023 14:47:49 +0100 Subject: [PATCH 04/26] Added working firerate to weapons & sorted out hold and tap fire --- .../Blueprints/BP_FirstPersonCharacter.uasset | 4 +-- .../Blueprints/BP_PickUp_Rifle.uasset | 4 +-- .../Input/Actions/IA_HoldShoot.uasset | 3 -- .../FirstPerson/Input/Actions/IA_Shoot.uasset | 3 ++ .../Input/Actions/IA_TapShoot.uasset | 3 -- .../FirstPerson/Input/IMC_Default.uasset | 4 +-- .../FirstPerson/Input/IMC_Weapons.uasset | 4 +-- .../EndlessVendettaCharacter.cpp | 25 +++---------- .../EndlessVendettaCharacter.h | 6 +--- .../WeaponSystem/BaseWeaponClass.cpp | 35 ++++--------------- .../WeaponSystem/BaseWeaponClass.h | 5 +-- 11 files changed, 24 insertions(+), 72 deletions(-) delete mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_HoldShoot.uasset create mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Shoot.uasset delete mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_TapShoot.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 7d416e94..62e16495 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00e38eda0524fe228dc71f14ef9f96ebec3f8142ffaeca9366f253a7456d529b -size 27305 +oid sha256:059c5de9ae43a57d471949157f8c1e59bcbc14c1ca117627ccb9d1b27036c180 +size 27098 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_PickUp_Rifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_PickUp_Rifle.uasset index 42fff7f9..a8f825b9 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_PickUp_Rifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_PickUp_Rifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d156d6fe24779674a35f18f9209313b0c2096d22772400c4d10c241a2e59e9e -size 21649 +oid sha256:118d852be72576a513c2a8c719e1d94450907a5dc00f27dd98914deb48a18c09 +size 21604 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_HoldShoot.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_HoldShoot.uasset deleted file mode 100644 index ac52169f..00000000 --- a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_HoldShoot.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1360a5e75da75d76374ea2091191ab85eab8ae0407f660ec7e242bdb51056670 -size 1659 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Shoot.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Shoot.uasset new file mode 100644 index 00000000..0186b774 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Shoot.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d92be41146c90185585f7a2de5a18d31a688d2cc8dfb22b24b9a7a92dbfd1ce1 +size 1355 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_TapShoot.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_TapShoot.uasset deleted file mode 100644 index b951ed44..00000000 --- a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_TapShoot.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3d02927e6f81929b1b6715400ce5f1a62361f239a5baad938902ae86b61ddc55 -size 1657 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset index 55abcd6c..6c703775 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3af06cb5478091fcf55d1069e28395f32708276bd53cc5dce82faa2a2d1f822b -size 16317 +oid sha256:639f363d6702f2597b9140becc6854a1a5e5872978e79c4a83b062ccec7c1966 +size 15739 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Weapons.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Weapons.uasset index e0d25572..0f7cd254 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Weapons.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Weapons.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99664f7a2d02cd77eec769cd0a690345e80de975fcacb8a615346583218e1b15 -size 4138 +oid sha256:24bf0d5a1ecce706cf33ff99e0ba7c1e0601dea5433ffd1f61732d522c9f4488 +size 4115 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 5a08ac16..38f6b3b4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -88,9 +88,7 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* EnhancedInputComponent->BindAction(EquipSecondaryWeapon, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::EquipSecondary); //Weapon Shooting - EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller); - EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::HoldFireCaller); - //EnhancedInputComponent->BindAction(HoldShootAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::CancelFire); + EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::FireCaller); } } @@ -195,34 +193,19 @@ void AEndlessVendettaCharacter::EquipSecondary() } //Calls the fire function in the baseWeaponClass -void AEndlessVendettaCharacter::TapFireCaller() +void AEndlessVendettaCharacter::FireCaller() { UE_LOG(LogTemp, Warning, TEXT("Tap Fire")); if (IsValid(PrimaryWeapon)) { - PrimaryWeapon->TapFire(); + PrimaryWeapon->Fire(); } if (IsValid(SecondaryWeapon)) { - SecondaryWeapon->TapFire(); + SecondaryWeapon->Fire(); } } -void AEndlessVendettaCharacter::HoldFireCaller() -{ - UE_LOG(LogTemp, Warning, TEXT("Hold Fire")); - if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) - { - PrimaryWeapon->HoldFire(); - } -} - -void AEndlessVendettaCharacter::CancelFire() -{ - PrimaryWeapon->CancelFire(); -} - - void AEndlessVendettaCharacter::Move(const FInputActionValue& Value) { diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 837ae1d4..259737a7 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -101,12 +101,8 @@ public: ABaseWeaponClass* SecondaryWeapon; UFUNCTION(BlueprintCallable, Category = "Weapons") - void TapFireCaller(); + void FireCaller(); - UFUNCTION(BlueprintCallable, Category = "Weapons") - void HoldFireCaller(); - - void CancelFire(); protected: /** Called for movement input */ diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 102ddcf9..5bcf7c6a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -39,13 +39,7 @@ void ABaseWeaponClass::Tick(float DeltaTime) void ABaseWeaponClass::ClickDetectionTimer() { - if (GetWorldTimerManager().IsTimerActive(timerHandle)) - { - return; - } - GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::TapFire, 1 / FireRate, false); - - + GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::Fire, 1 / FireRate, false); } void ABaseWeaponClass::CancelFire() @@ -53,7 +47,7 @@ void ABaseWeaponClass::CancelFire() GetWorldTimerManager().ClearTimer(timerHandle); } -void ABaseWeaponClass::TapFire() +void ABaseWeaponClass::Fire() { FHitResult outHit; FVector traceStart; @@ -63,32 +57,17 @@ void ABaseWeaponClass::TapFire() FCollisionQueryParams collisionParams; collisionParams.AddIgnoredActor(player); collisionParams.AddIgnoredActor(this); + if (GetWorldTimerManager().IsTimerActive(timerHandle)) + { + return; + } GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); - //Debug line to see where the trace hit DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); + ClickDetectionTimer(); if (outHit.bBlockingHit) { UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); } } -void ABaseWeaponClass::HoldFire() -{ - FHitResult outHit; - FVector traceStart; - FVector traceEnd; - traceStart = GunStartArrow->GetComponentLocation(); - traceEnd = traceStart + (player->GetActorForwardVector() * BulletDistance); - FCollisionQueryParams collisionParams; - collisionParams.AddIgnoredActor(player); - collisionParams.AddIgnoredActor(this); - GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); - - //Debug line to see where the trace hit - DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); - if (outHit.bBlockingHit) - { - UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); - } -} diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 903e46ff..67be17fc 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -43,10 +43,7 @@ public: UTexture2D* WeaponImage; UFUNCTION(BlueprintCallable, Category = "Weapons") - void TapFire(); - - UFUNCTION(BlueprintCallable, Category = "Weapons") - void HoldFire(); + void Fire(); UFUNCTION(BlueprintCallable, Category = "Weapons") void ClickDetectionTimer(); From c4da037d2d74c65dac051a82bfb0f487e4c4a9e2 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 2 Oct 2023 14:52:30 +0100 Subject: [PATCH 05/26] Updated SecondaryWeapons BulletTravel --- .../Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset index 3f00099b..a1f00f47 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:202ab16b4ffa35b8b8140c728744b529514cd98e7cf595a674e0bd13bcfbaff9 -size 29227 +oid sha256:69e0dd14f07413220251048a5a7bb322eebd9e2d9362dc29bab3d3de096a9a82 +size 29337 From a2035ffe2fac8b09a06f381032fd015026788ba6 Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Wed, 4 Oct 2023 15:45:43 +0100 Subject: [PATCH 06/26] Cleaned up & added Weapon kick shake (non-universal) --- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 ++-- .../Blueprints/BaseWeapons/BP_BaseWeapon.uasset | 4 ++-- .../BaseWeapons/BP_GunCameraShake.uasset | 3 +++ .../Pistols/BP_BasePistolWeapon.uasset | 4 ++-- .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 2 +- .../WeaponSystem/BaseWeaponClass.cpp | 16 ++++++++++++++-- .../WeaponSystem/BaseWeaponClass.h | 15 ++++++++------- .../EndlessVendetta/WeaponSystem/PistolClass.cpp | 6 ++++++ .../EndlessVendetta/WeaponSystem/PistolClass.h | 2 ++ 9 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 998ce21b..d62958e4 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c3599c78d84a6895d06de8ce3697a6aefd517ac0105d041cab6f5124090bb3b -size 35834 +oid sha256:fc4caf67df37627a19c4b9f2c464d84cb293574db45f018458c0d59e0a15ba1a +size 37750 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index f09d81f5..e4f50596 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:694f084a31b369305b9cf0e066786a624f73721bf819d3823177703341f0b98c -size 28902 +oid sha256:77b4872fd2fde68620f3fb539222718cbe2c66160a956c6373d3650c58a9bf88 +size 29117 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset new file mode 100644 index 00000000..a24df98a --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b5bc4f06eaeb74c61b627c02ff6e49dedeebfe047bc79fbfa8941b25c4674ef +size 7209 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset index a1f00f47..1a6ea0df 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69e0dd14f07413220251048a5a7bb322eebd9e2d9362dc29bab3d3de096a9a82 -size 29337 +oid sha256:668c94fe648e9fde608e3a07b193f42087fddc44d0e76ec3e4705be642f78679 +size 29493 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset index b70bdb74..3f91ee89 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51fdff374c4c25c321646b9315bc5286b1ddc89511a597538bf96bea96222e02 +oid sha256:f9dd9531bbf28069122709420605ec7c6478ddea44b642b28f016b2349a05597 size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 5bcf7c6a..0c3cafba 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -2,7 +2,11 @@ #include "BaseWeaponClass.h" + +#include "AIHelpers.h" +#include "GeneratedCodeHelpers.h" #include "EndlessVendetta/EndlessVendettaCharacter.h" +#include "Kismet/KismetMathLibrary.h" #include "Components/CapsuleComponent.h" #include "Kismet/GameplayStatics.h" @@ -28,6 +32,11 @@ void ABaseWeaponClass::BeginPlay() GunStartArrow = Cast(actorComp); break; } + + if (!playerControllerRef) + { + playerControllerRef = UGameplayStatics::GetPlayerController(GetWorld(), 0); + } } @@ -35,6 +44,7 @@ void ABaseWeaponClass::BeginPlay() void ABaseWeaponClass::Tick(float DeltaTime) { Super::Tick(DeltaTime); + } void ABaseWeaponClass::ClickDetectionTimer() @@ -47,6 +57,7 @@ void ABaseWeaponClass::CancelFire() GetWorldTimerManager().ClearTimer(timerHandle); } + void ABaseWeaponClass::Fire() { FHitResult outHit; @@ -63,11 +74,12 @@ void ABaseWeaponClass::Fire() } GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); //Debug line to see where the trace hit - DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, true, 500.0f, 0U, 5.f); + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); + playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); ClickDetectionTimer(); if (outHit.bBlockingHit) { UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); } } - + diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 67be17fc..a32c90bc 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "WeaponItemClass.h" #include "Components/ArrowComponent.h" +#include "Kismet/KismetMathLibrary.h" #include "BaseWeaponClass.generated.h" class AEndlessVendettaCharacter; @@ -43,7 +44,7 @@ public: UTexture2D* WeaponImage; UFUNCTION(BlueprintCallable, Category = "Weapons") - void Fire(); + virtual void Fire(); UFUNCTION(BlueprintCallable, Category = "Weapons") void ClickDetectionTimer(); @@ -53,10 +54,16 @@ public: UPROPERTY(VisibleAnywhere) ACharacter* player; + UPROPERTY() + APlayerController* playerControllerRef; + FTimerHandle timerHandle; bool bFirstBulletShot = false; + UPROPERTY(EditAnywhere) + TSubclassOf CameraShakeClass; + private: UArrowComponent* GunStartArrow; @@ -64,10 +71,4 @@ private: UPROPERTY(EditAnywhere) float BulletDistance; - - //Add HoldFire functionality after pistol is complete for holding fire for pistol and make it start spraying innacuratly. - - // UFUNCTION(BlueprintCallable, Category = "Weapons") - // void HoldFire(); - }; diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.cpp index c40b9fdc..2b7dc95a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.cpp @@ -24,3 +24,9 @@ void APistolClass::Tick(float DeltaTime) Super::Tick(DeltaTime); } +void APistolClass::Fire() +{ + Super::Fire(); + UE_LOG(LogTemp, Display, TEXT("Testing overrides: Pistol has been fired")); +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.h index 4ad676b2..ca85b67e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/PistolClass.h @@ -22,4 +22,6 @@ protected: public: // Called every frame virtual void Tick(float DeltaTime) override; + + virtual void Fire() override; }; From 2f0a49faafc1fde775a30236699d6e58c943d83d Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Wed, 4 Oct 2023 16:11:31 +0100 Subject: [PATCH 07/26] Added base weapon camera shake class --- .../WeaponSystem/BaseWeaponClass.cpp | 1 + .../WeaponSystem/WeaponCameraShake.cpp | 4 ++++ .../WeaponSystem/WeaponCameraShake.h | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.h diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 0c3cafba..92a56a31 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -60,6 +60,7 @@ void ABaseWeaponClass::CancelFire() void ABaseWeaponClass::Fire() { + //do damage fallof based off distance FHitResult outHit; FVector traceStart; FVector traceEnd; diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.cpp new file mode 100644 index 00000000..03a594a9 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.cpp @@ -0,0 +1,4 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "WeaponCameraShake.h" diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.h new file mode 100644 index 00000000..604113b5 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/WeaponCameraShake.h @@ -0,0 +1,16 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" + +#include "WeaponCameraShake.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API UWeaponCameraShake : public UCameraShakeBase +{ + GENERATED_BODY() +}; From e9cacdb064dc6c01419afa186691ae5a013ae08a Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 5 Oct 2023 10:48:44 +0100 Subject: [PATCH 08/26] Added temp crosshair to level --- .../FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset | 4 ++-- .../Blueprints/BaseWeapons/Images/crosshair.uasset | 3 +++ ...-god-hates-us-all-album-cover-11562902578sasayvkjg8.uasset | 3 +++ .../Content/FirstPerson/Blueprints/WBP_Crosshair.uasset | 3 +++ .../Content/StarterContent/Architecture/Floor_400x400.uasset | 4 ++-- .../StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset | 4 ++-- .../GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp | 4 ++-- 7 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/crosshair.uasset create mode 100644 EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/fadenkreuz-transparent-crosshair-slayer-god-hates-us-all-album-cover-11562902578sasayvkjg8.uasset create mode 100644 EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 62e16495..0e677a52 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:059c5de9ae43a57d471949157f8c1e59bcbc14c1ca117627ccb9d1b27036c180 -size 27098 +oid sha256:a64df34489d5d5452a5b7310e944fd0cb2ea1a2a52eacf2c7bcf9a8d03aadb2c +size 40999 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/crosshair.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/crosshair.uasset new file mode 100644 index 00000000..aeb09d75 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/crosshair.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:110eea3093bb784d7c237753fcd6f029cc8d3b388991f886a9752d6960195e14 +size 12511 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/fadenkreuz-transparent-crosshair-slayer-god-hates-us-all-album-cover-11562902578sasayvkjg8.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/fadenkreuz-transparent-crosshair-slayer-god-hates-us-all-album-cover-11562902578sasayvkjg8.uasset new file mode 100644 index 00000000..2caf2972 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Images/fadenkreuz-transparent-crosshair-slayer-god-hates-us-all-album-cover-11562902578sasayvkjg8.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df1398829f499b8a95bd2a912851aa613d1b26519496f1bc38a58db91c2a7730 +size 62044 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset new file mode 100644 index 00000000..bdd28701 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3c0a70c5b68ec66372ae8e29abcb76deb385319f24202e43395c9061b3d0f8a +size 24854 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index ec9ee977..c2a34afc 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d4e6c0e1dad79feeaa5078889de9cf4c6753f1e77cf7d17a3eb3de082b91d4ae -size 14831 +oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 +size 14948 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index 0f990580..48901753 100644 --- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset +++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc35eb2d43a47427d30aba0196f9eac90d089dd3abca319528c5d25c83510d0d -size 72364642 +oid sha256:2f245999e23fa99035343927a6662fb51718dfc13fbb549ffb43d3f94b47e375 +size 66790690 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp index b81b4d54..feac557c 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp @@ -57,11 +57,11 @@ void AVisionLinkEnemyLOSTest::TestLOS(TArray EnemiesInLink, AActor* LOS return; } - for (AActor* Enemy : OverlappingEnemies) + /*for (AActor* Enemy : OverlappingEnemies) { FRotator LookAtRotation = UKismetMathLibrary::FindLookAtRotation(LOSActor->GetActorLocation(), Enemy->GetActorLocation()); UE_LOG(LogTemp, Warning, TEXT("Look at Rotation: %f"), LookAtRotation.Yaw); - } + }*/ Destroy(); From fed628ed770d7a4c07eafc97fa646ed6e8768c49 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 5 Oct 2023 12:24:18 +0100 Subject: [PATCH 09/26] Added weapon recoil for all future guns --- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../BaseWeapons/BP_BaseWeapon.uasset | 4 +- .../Pistols/BP_BasePistolWeapon.uasset | 4 +- .../WeaonRecoil/AssaultRecoilPattern.uasset | 3 + .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 2 +- .../WeaponSystem/BaseWeaponClass.cpp | 76 ++++++++++++++++++- .../WeaponSystem/BaseWeaponClass.h | 44 +++++++++++ 7 files changed, 128 insertions(+), 9 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index d62958e4..ef248e2a 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc4caf67df37627a19c4b9f2c464d84cb293574db45f018458c0d59e0a15ba1a -size 37750 +oid sha256:cff6a88ce5641de43b7168dbe156dc6c743108fd4fe22dd89647224cdc5249fc +size 37804 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index e4f50596..eb786d5b 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77b4872fd2fde68620f3fb539222718cbe2c66160a956c6373d3650c58a9bf88 -size 29117 +oid sha256:c12dd919c67095a4cdc8439b9a0e8c25d5d65566abbd657d7b43bcdf6dac24b8 +size 29704 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset index 1a6ea0df..ea240160 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:668c94fe648e9fde608e3a07b193f42087fddc44d0e76ec3e4705be642f78679 -size 29493 +oid sha256:71b1463641785fe268bbea7f26c1e1d12cb0703f47b2ec1c50afd19ed3f061ed +size 30046 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset new file mode 100644 index 00000000..6fa60a25 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f4479a0f7cd596b9f9d263ba4898b07487d8e065ec43bd14dd4ea87d239695d +size 2006 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset index 3f91ee89..82931fab 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9dd9531bbf28069122709420605ec7c6478ddea44b642b28f016b2349a05597 +oid sha256:1beca35b5b67f492442adf27a1933f51133cce10ed01c3ae69b21a371efe6c4e size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 92a56a31..170ad5ab 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -44,9 +44,81 @@ void ABaseWeaponClass::BeginPlay() void ABaseWeaponClass::Tick(float DeltaTime) { Super::Tick(DeltaTime); - + + if (player) + { + ApplyRecoil(DeltaTime); + } } + + + +// Recoil Handling // +void ABaseWeaponClass::GenerateRecoilVector() +{ + float angle = FMath::RandRange(recoilMaxAngleLeft, -recoilMaxAngleRight); //randomg recoil vector angle between left and right + float recMag = recoilMagnitude * 252.f; //converting degrees to controller units + float tempMag = -FMath::RandRange(recMag * recoilMinMultiplier, recMag); // recoil magnitude + + recoilResultYaw = FMath::Sin(FMath::DegreesToRadians(angle)); + recoilResultPitch = FMath::Cos(FMath::DegreesToRadians(angle)); + + //scaling direction to magnitude + recoilResultPitch *= -tempMag; + recoilResultYaw *= tempMag; + + //reset recoil to 0 of curve + recoilTime = 0; +} + +void ABaseWeaponClass::ApplyRecoil(float DeltaTime) +{ + if (recoilTime < 0.3) + { + float amplitude = RecoilCurve->GetFloatValue(recoilTime); //get current value of curve in time + recoilTime += DeltaTime; + player->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime)); + player->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime)); + UpdateSamples(amplitude, recoilTime); + } +} + +void ABaseWeaponClass::nullSamples() +{ + recoilCurvet = 0; + recoilCurvez1 = 0; +} + +float ABaseWeaponClass::GetRecoilPitch(float Amp, float Time) +{ + //Using the trapez method and we are getting the surface under the curve, each trapezoid consist of square and right triangle + float lower = recoilCurvez1 < Amp ? recoilCurvez1 : Amp; //get which point is common for both triangle and square of trapezoid + //lower point + float mult = (Time - recoilCurvet) * lower; //getting surface of square + mult += (Time - recoilCurvet) * (Amp - recoilCurvez1) / 2.0f; //getting and adding surface of triangle + return (recoilResultPitch * mult) / playerControllerRef->InputPitchScale_DEPRECATED; //calculating and return recoil force for current frame +} + + +//Same as getrecoilpitch +float ABaseWeaponClass::GetRecoilYaw(float Amp, float Time) +{ + float lower = recoilCurvez1 < Amp ? recoilCurvez1 : Amp; + float mult = (Time - recoilCurvet) * lower; + + mult += (Time - recoilCurvet) * (Amp - recoilCurvez1) / 2.0f; + return (recoilResultYaw * mult) / playerControllerRef->InputYawScale_DEPRECATED; +} + +void ABaseWeaponClass::UpdateSamples(float Amp, float Time) +{ + recoilCurvez1 = Amp; + recoilCurvet = Time; +} + + +// Fire handling // void ABaseWeaponClass::ClickDetectionTimer() { GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::Fire, 1 / FireRate, false); @@ -57,7 +129,6 @@ void ABaseWeaponClass::CancelFire() GetWorldTimerManager().ClearTimer(timerHandle); } - void ABaseWeaponClass::Fire() { //do damage fallof based off distance @@ -77,6 +148,7 @@ void ABaseWeaponClass::Fire() //Debug line to see where the trace hit DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); + GenerateRecoilVector(); ClickDetectionTimer(); if (outHit.bBlockingHit) { diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index a32c90bc..b7e3b654 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -24,6 +24,23 @@ protected: // Called when the game starts or when spawned virtual void BeginPlay() override; + void GenerateRecoilVector(); + + void ApplyRecoil(float DeltaTime); + + void nullSamples(); + + //recoil previous curve + float recoilCurvez1 = 0; + + //recoil previous curve time + float recoilCurvet = 0; + + float recoilTime = 0; + + float recoilResultPitch = 0; + float recoilResultYaw = 0; + public: // Called every frame virtual void Tick(float DeltaTime) override; @@ -64,6 +81,33 @@ public: UPROPERTY(EditAnywhere) TSubclassOf CameraShakeClass; + /* How far the gun goes up*/ + UPROPERTY(EditAnywhere, Category = "Recoil") + float recoilMagnitude; + + UPROPERTY(EditAnywhere, Category = "Recoil") + float recoilMaxAngleLeft; + + UPROPERTY(EditAnywhere, Category = "Recoil") + float recoilMaxAngleRight; + + UPROPERTY(EditAnywhere, Category = "Recoil") + float recoilMinMultiplier; + + UPROPERTY(EditAnywhere, Category = "Recoil") + class UCurveFloat* RecoilCurve; + + UFUNCTION(BlueprintCallable, Category = "Recoil") + float GetRecoilPitch(float Amp, float Time); + + UFUNCTION(BlueprintCallable, Category = "Recoil") + float GetRecoilYaw(float Amp, float Time); + + UFUNCTION(BlueprintCallable, Category = "Recoil") + void UpdateSamples(float Amp, float Time); + + + private: UArrowComponent* GunStartArrow; From b93e78108e826bf50cb3607099073ba6cf889538 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Fri, 6 Oct 2023 13:42:20 +0100 Subject: [PATCH 10/26] Added Stand-In Dead Enemy --- EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset | 3 +++ .../Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset | 4 ++-- EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap | 4 ++-- .../Content/StarterContent/Architecture/Floor_400x400.uasset | 4 ++-- .../StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset diff --git a/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset b/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset new file mode 100644 index 00000000..bbf47748 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f28b60c8b026af2e9c599996f99ccc333e23e38bac7fcaf83d345bb48703edf +size 28631 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset index a52acef6..f0c43d86 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00ef54778dd4058c75ad6dca1b46531f8b20b3b154373294be43fa8d5e9ebbdc -size 106247 +oid sha256:f40722ce6381c0b65978b90489e162c36b1335524162d4b112fe22a6d382fc24 +size 108529 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index cb32e614..80f122b6 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b05392dd6ea5c33327b50c71be4e3b736b96c356d8de84d894562af209c1f75 -size 103876 +oid sha256:d2231f4d2a4b46f8a7daa258e14487b5ee0c0d6ed602fa256de0ef9cdd04f188 +size 106160 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..699c604a 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:c4ecdd1c9e06062da33fac4c12ca5f4011e86800bee678d985f6c95066e281d1 +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index caa0814c..0f990580 100644 --- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset +++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81331a890b185a2c1bc418da80b947c289a8ab67ff91737e9b187c45c71d083d -size 66790690 +oid sha256:bc35eb2d43a47427d30aba0196f9eac90d089dd3abca319528c5d25c83510d0d +size 72364642 From 2c299728102b1f3d1ee53ed036e73477adae0b73 Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Fri, 6 Oct 2023 16:11:28 +0100 Subject: [PATCH 11/26] Added Basic weapon scope in functionality --- EndlessVendetta/Config/DefaultEditor.ini | 5 ++- .../FPWeapon/Mesh/SK_FPGun_Skeleton.uasset | 4 +- .../Blueprints/BP_FirstPersonCharacter.uasset | 4 +- .../BaseWeapons/BP_BaseWeapon.uasset | 4 +- .../Input/Actions/IA_GunAimIn.uasset | 3 ++ .../FirstPerson/Input/IMC_Default.uasset | 4 +- .../Animations/FirstPerson_AnimBP.uasset | 4 +- .../0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset | 3 -- .../EndlessVendettaCharacter.cpp | 40 ++++++++++++++++++- .../EndlessVendettaCharacter.h | 11 ++++- .../WeaponSystem/BaseWeaponClass.cpp | 17 +++++--- .../WeaponSystem/BaseWeaponClass.h | 3 +- 12 files changed, 78 insertions(+), 24 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset delete mode 100644 EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset diff --git a/EndlessVendetta/Config/DefaultEditor.ini b/EndlessVendetta/Config/DefaultEditor.ini index 58552fae..e7314343 100644 --- a/EndlessVendetta/Config/DefaultEditor.ini +++ b/EndlessVendetta/Config/DefaultEditor.ini @@ -5,4 +5,7 @@ SimpleMapName=/Game/FirstPerson/Maps/FirstPersonExampleMap bAllowClassAndBlueprintPinMatching=true bReplaceBlueprintWithClass= true bDontLoadBlueprintOutsideEditor= true -bBlueprintIsNotBlueprintType= true \ No newline at end of file +bBlueprintIsNotBlueprintType= true + +[/Script/AdvancedPreviewScene.SharedProfiles] + diff --git a/EndlessVendetta/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset b/EndlessVendetta/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset index 69ba91c0..c6396a47 100644 --- a/EndlessVendetta/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset +++ b/EndlessVendetta/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eec8c05a75e7932e3834cbc1cd1b112f29171212b871fa1552f458ceb1b65948 -size 8000 +oid sha256:f9c7063e48c0b3c23194a6a2fc3625da96d20bbd92fece19210001cf0cac8964 +size 8568 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 0e677a52..441dabb0 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a64df34489d5d5452a5b7310e944fd0cb2ea1a2a52eacf2c7bcf9a8d03aadb2c -size 40999 +oid sha256:ff90caf01f6ea20dccd612ea5629215ce5c5a4a63e4da2ec242cabf9000bd6c6 +size 42353 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index eb786d5b..dc2d119d 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c12dd919c67095a4cdc8439b9a0e8c25d5d65566abbd657d7b43bcdf6dac24b8 -size 29704 +oid sha256:af36276c4e513a207e06ec1eaa8f5c4273ab5634330a999db47ac9128e7d02ec +size 29776 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset new file mode 100644 index 00000000..59590b50 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75503df8d15af2a4661c6cd18bc8f690d50f79cafe5ea8e2b3665db0b882cc24 +size 1370 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset index 6c703775..bb4e7fab 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:639f363d6702f2597b9140becc6854a1a5e5872978e79c4a83b062ccec7c1966 -size 15739 +oid sha256:6a0af94b654f58c85c8b4453fa211608ecc7bc67b9c82e2e3768814e906babcd +size 16334 diff --git a/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset b/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset index c514eab5..20a95d4b 100644 --- a/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset +++ b/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:175427d440d7f510cbbfa4630c82a677a83348f3b3b5cc555e09a7b03cf2e4ee -size 473991 +oid sha256:bc9b39a1c54d40b77f7893a00f72fc8e3feedec1d19fbdfa2db4f64d47e63bc3 +size 478510 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset deleted file mode 100644 index 82931fab..00000000 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/0/3Z/SNIBJQL2L6YHSC7MTTK1C2.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1beca35b5b67f492442adf27a1933f51133cce10ed01c3ae69b21a371efe6c4e -size 5061 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 38f6b3b4..d7a13fac 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -89,6 +89,8 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* //Weapon Shooting EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::FireCaller); + EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::GunRightClick); + EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopGunRightClick); } } @@ -188,8 +190,6 @@ void AEndlessVendettaCharacter::EquipSecondary() AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); SecondaryWeapon = Cast(SecondaryWeaponActor); - - } //Calls the fire function in the baseWeaponClass @@ -206,6 +206,42 @@ void AEndlessVendettaCharacter::FireCaller() } } +void AEndlessVendettaCharacter::GunRightClick() +{ + if (IsValid(PrimaryWeapon)) + { + for (UActorComponent* actorComp : this->GetComponentsByTag(UArrowComponent::StaticClass(), FName("ScopedLocationArrow"))) + { + ScopedLocationArrow = Cast(actorComp); + break; + } + if (!IsValid(ScopedLocationArrow)) return; + PrimaryWeapon->SetActorLocation(ScopedLocationArrow->GetComponentLocation()); + PrimaryWeapon->WeaponScopedFire(); + this->GetFirstPersonCameraComponent()->SetFieldOfView(50); //change this number to a number you can change in editor eventually + } + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->WeaponScopedFire(); + SecondaryWeapon->SetActorLocation(ScopedLocationArrow->GetComponentLocation()); + this->GetFirstPersonCameraComponent()->SetFieldOfView(50); //change this number to a number you can change in editor eventually + } +} + +void AEndlessVendettaCharacter::StopGunRightClick() +{ + if (IsValid(PrimaryWeapon)) + { + PrimaryWeapon->SetActorRelativeLocation(FVector(0,0,0)); + this->GetFirstPersonCameraComponent()->SetFieldOfView(90); + } + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->SetActorRelativeLocation(FVector(0,0,0)); + this->GetFirstPersonCameraComponent()->SetFieldOfView(90); + } +} + void AEndlessVendettaCharacter::Move(const FInputActionValue& Value) { diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 259737a7..597364e8 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -58,9 +58,9 @@ class AEndlessVendettaCharacter : public ACharacter UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) class UInputAction* TapShootAction; - + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) - class UInputAction* HoldShootAction; + class UInputAction* GunAimInAction; public: AEndlessVendettaCharacter(); @@ -103,6 +103,13 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void FireCaller(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void GunRightClick(); + + UFUNCTION(BlueprintCallable, Category = "Weapons") + void StopGunRightClick(); + + UArrowComponent* ScopedLocationArrow; protected: /** Called for movement input */ diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 170ad5ab..1e914665 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -52,9 +52,7 @@ void ABaseWeaponClass::Tick(float DeltaTime) } - - -// Recoil Handling // +// Recoil Handling //////////////////////////////////////////////////////////////////////////////////////////////////////////// void ABaseWeaponClass::GenerateRecoilVector() { float angle = FMath::RandRange(recoilMaxAngleLeft, -recoilMaxAngleRight); //randomg recoil vector angle between left and right @@ -117,8 +115,7 @@ void ABaseWeaponClass::UpdateSamples(float Amp, float Time) recoilCurvet = Time; } - -// Fire handling // +// Fire handling ////////////////////////////////////////////////////////////////////////////////////////////////////////// void ABaseWeaponClass::ClickDetectionTimer() { GetWorldTimerManager().SetTimer(timerHandle, this, &ABaseWeaponClass::Fire, 1 / FireRate, false); @@ -155,4 +152,14 @@ void ABaseWeaponClass::Fire() UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); } } + +void ABaseWeaponClass::WeaponScopedFire() +{ + UE_LOG(LogTemp, Display, TEXT("Activated WeaponScopedFire function in BaseWeaponClass")); + recoilMagnitude -= 0.2f; + recoilMaxAngleLeft /= 2.f; + recoilMaxAngleRight /= 2.f; + recoilMinMultiplier -= 2.f; +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index b7e3b654..4e3e498a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -106,7 +106,8 @@ public: UFUNCTION(BlueprintCallable, Category = "Recoil") void UpdateSamples(float Amp, float Time); - + UFUNCTION(BlueprintCallable, Category = "Weapons") + void WeaponScopedFire(); private: From 13a3900e6d9075576c266927f972d763740261d0 Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Fri, 6 Oct 2023 17:21:17 +0100 Subject: [PATCH 12/26] Added Aim In Functionality for weapons --- EndlessVendetta/Config/DefaultEngine.ini | 3 ++ .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../Input/Actions/IA_GunAimIn.uasset | 2 +- .../Animations/FirstPerson_AnimBP.uasset | 2 +- .../EndlessVendettaCharacter.cpp | 18 ++++++++- .../EndlessVendettaCharacter.h | 3 ++ .../WeaponSystem/BaseWeaponClass.cpp | 40 +++++++++++++------ .../WeaponSystem/BaseWeaponClass.h | 12 ++++-- 8 files changed, 63 insertions(+), 21 deletions(-) diff --git a/EndlessVendetta/Config/DefaultEngine.ini b/EndlessVendetta/Config/DefaultEngine.ini index f61108f4..8a52ed56 100644 --- a/EndlessVendetta/Config/DefaultEngine.ini +++ b/EndlessVendetta/Config/DefaultEngine.ini @@ -87,3 +87,6 @@ ConnectionType=USBOnly bUseManualIPAddress=False ManualIPAddress= + +[CoreRedirects] ++PropertyRedirects=(OldName="/Script/EndlessVendetta.BaseWeaponClass.player",NewName="/Script/EndlessVendetta.BaseWeaponClass.playerInWorld") \ No newline at end of file diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index ef248e2a..075055c8 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cff6a88ce5641de43b7168dbe156dc6c743108fd4fe22dd89647224cdc5249fc -size 37804 +oid sha256:4473a9d8bdd893373d3b489bc1ccb878bc568d94b9b495b1e2be83880bac0959 +size 37793 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset index 59590b50..e3118a9f 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_GunAimIn.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75503df8d15af2a4661c6cd18bc8f690d50f79cafe5ea8e2b3665db0b882cc24 +oid sha256:8b9f2db74a440d4cbe20066719467311b6d43de3676027ec2162fc39a2c7ac85 size 1370 diff --git a/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset b/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset index 20a95d4b..44d21afa 100644 --- a/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset +++ b/EndlessVendetta/Content/FirstPersonArms/Animations/FirstPerson_AnimBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc9b39a1c54d40b77f7893a00f72fc8e3feedec1d19fbdfa2db4f64d47e63bc3 +oid sha256:bd95413d072ec5535444d09946cfb0ec3f4f6392ff5712e60fa521c845b23cdc size 478510 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index d7a13fac..93a21cd9 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -141,6 +141,7 @@ void AEndlessVendettaCharacter::EquipPrimary() if (IsValid(PrimaryWeapon)) { PrimaryWeapon->Destroy(); + this->GetFirstPersonCameraComponent()->SetFieldOfView(90); PrimaryWeapon = nullptr; bHasRifle = false; return; @@ -171,6 +172,7 @@ void AEndlessVendettaCharacter::EquipSecondary() if (IsValid(SecondaryWeapon)) { SecondaryWeapon->Destroy(); + this->GetFirstPersonCameraComponent()->SetFieldOfView(90); SecondaryWeapon = nullptr; bHasRifle = false; return; @@ -208,7 +210,7 @@ void AEndlessVendettaCharacter::FireCaller() void AEndlessVendettaCharacter::GunRightClick() { - if (IsValid(PrimaryWeapon)) + if (IsValid(PrimaryWeapon) && !bIsScoped) { for (UActorComponent* actorComp : this->GetComponentsByTag(UArrowComponent::StaticClass(), FName("ScopedLocationArrow"))) { @@ -217,11 +219,19 @@ void AEndlessVendettaCharacter::GunRightClick() } if (!IsValid(ScopedLocationArrow)) return; PrimaryWeapon->SetActorLocation(ScopedLocationArrow->GetComponentLocation()); + bIsScoped = true; PrimaryWeapon->WeaponScopedFire(); this->GetFirstPersonCameraComponent()->SetFieldOfView(50); //change this number to a number you can change in editor eventually } - if (IsValid(SecondaryWeapon)) + if (IsValid(SecondaryWeapon) && !bIsScoped) { + for (UActorComponent* actorComp : this->GetComponentsByTag(UArrowComponent::StaticClass(), FName("ScopedLocationArrow"))) + { + ScopedLocationArrow = Cast(actorComp); + break; + } + if (!IsValid(ScopedLocationArrow)) return; + bIsScoped = true; SecondaryWeapon->WeaponScopedFire(); SecondaryWeapon->SetActorLocation(ScopedLocationArrow->GetComponentLocation()); this->GetFirstPersonCameraComponent()->SetFieldOfView(50); //change this number to a number you can change in editor eventually @@ -232,11 +242,15 @@ void AEndlessVendettaCharacter::StopGunRightClick() { if (IsValid(PrimaryWeapon)) { + bIsScoped = false; + PrimaryWeapon->WeaponScopedFire(); PrimaryWeapon->SetActorRelativeLocation(FVector(0,0,0)); this->GetFirstPersonCameraComponent()->SetFieldOfView(90); } if (IsValid(SecondaryWeapon)) { + bIsScoped = false; + SecondaryWeapon->WeaponScopedFire(); SecondaryWeapon->SetActorRelativeLocation(FVector(0,0,0)); this->GetFirstPersonCameraComponent()->SetFieldOfView(90); } diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 597364e8..8762426a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -111,6 +111,9 @@ public: UArrowComponent* ScopedLocationArrow; + UPROPERTY(EditAnywhere, Category = "Dont Touch") + bool bIsScoped; + protected: /** Called for movement input */ void Move(const FInputActionValue& Value); diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 1e914665..b0ff8a20 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -25,9 +25,11 @@ void ABaseWeaponClass::BeginPlay() // Attempt to find the player character APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0); - player = Cast(PlayerController->GetCharacter()); + playerInWorld = Cast(PlayerController->GetCharacter()); + + endlessVendettaChar = Cast(playerInWorld); - for (UActorComponent* actorComp : player->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart"))) + for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart"))) { GunStartArrow = Cast(actorComp); break; @@ -37,7 +39,11 @@ void ABaseWeaponClass::BeginPlay() { playerControllerRef = UGameplayStatics::GetPlayerController(GetWorld(), 0); } - + + originalMagnitude = recoilMagnitude; + originalMaxAngleLeft = recoilMaxAngleLeft; + originalMaxAngleRight = recoilMaxAngleRight; + originalMinMultiplier = recoilMinMultiplier; } // Called every frame @@ -45,7 +51,7 @@ void ABaseWeaponClass::Tick(float DeltaTime) { Super::Tick(DeltaTime); - if (player) + if (playerInWorld) { ApplyRecoil(DeltaTime); } @@ -76,8 +82,8 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime) { float amplitude = RecoilCurve->GetFloatValue(recoilTime); //get current value of curve in time recoilTime += DeltaTime; - player->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime)); - player->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime)); + playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime)); + playerInWorld->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime)); UpdateSamples(amplitude, recoilTime); } } @@ -135,7 +141,7 @@ void ABaseWeaponClass::Fire() traceStart = GunStartArrow->GetComponentLocation(); traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); FCollisionQueryParams collisionParams; - collisionParams.AddIgnoredActor(player); + collisionParams.AddIgnoredActor(playerInWorld); collisionParams.AddIgnoredActor(this); if (GetWorldTimerManager().IsTimerActive(timerHandle)) { @@ -155,11 +161,21 @@ void ABaseWeaponClass::Fire() void ABaseWeaponClass::WeaponScopedFire() { - UE_LOG(LogTemp, Display, TEXT("Activated WeaponScopedFire function in BaseWeaponClass")); - recoilMagnitude -= 0.2f; - recoilMaxAngleLeft /= 2.f; - recoilMaxAngleRight /= 2.f; - recoilMinMultiplier -= 2.f; + if (endlessVendettaChar->bIsScoped) + { + recoilMagnitude -= 0.2f; + recoilMaxAngleLeft /= 2.f; + recoilMaxAngleRight /= 2.f; + recoilMinMultiplier -= 0.2f; + + } + else + { + recoilMagnitude = originalMagnitude; + recoilMaxAngleLeft = originalMaxAngleLeft; + recoilMaxAngleRight = originalMaxAngleRight; + recoilMinMultiplier = originalMinMultiplier; + } } diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 4e3e498a..8eb2d617 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -69,9 +69,10 @@ public: void CancelFire(); UPROPERTY(VisibleAnywhere) - ACharacter* player; - - UPROPERTY() + ACharacter* playerInWorld; + + AEndlessVendettaCharacter* endlessVendettaChar; + APlayerController* playerControllerRef; FTimerHandle timerHandle; @@ -115,5 +116,10 @@ private: UPROPERTY(EditAnywhere) float BulletDistance; + + float originalMagnitude; + float originalMaxAngleLeft; + float originalMaxAngleRight; + float originalMinMultiplier; }; From c025d84a907af5ab6c9a4ee5f11d41a748a87bb9 Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Fri, 6 Oct 2023 17:29:55 +0100 Subject: [PATCH 13/26] Changed weapon values --- .../BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset | 4 ++-- .../BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 075055c8..bda0660d 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4473a9d8bdd893373d3b489bc1ccb878bc568d94b9b495b1e2be83880bac0959 -size 37793 +oid sha256:4b3aee8c3c553b35b2e127ddd7dd44974fda5563ad4eb9bc18a34efceee4d004 +size 37850 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset index 6fa60a25..423c7283 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f4479a0f7cd596b9f9d263ba4898b07487d8e065ec43bd14dd4ea87d239695d -size 2006 +oid sha256:b63c754fc78a67f950a91e30dd31a6778bac31a485191b9cc14560515d5012a5 +size 2033 From 0f5c983e755e400596719db30446f8a01c621f3e Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Fri, 6 Oct 2023 18:27:33 +0100 Subject: [PATCH 14/26] Implemented AOverloadModule and its Activation Functions --- .../OverloadModule/CG_OverloadModule.uasset | 3 + .../Content/Levels/GadgetSystemTestLevel.umap | 4 +- .../Architecture/Floor_400x400.uasset | 4 +- .../Props/MaterialSphere.uasset | 4 +- .../Combat/OverloadModule/OverloadModule.cpp | 122 ++++++++++++++++++ .../Combat/OverloadModule/OverloadModule.h | 64 +++++++++ 6 files changed, 195 insertions(+), 6 deletions(-) create mode 100644 EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset new file mode 100644 index 00000000..4d8790c5 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d61bb4d0a3f7c25b8901699a8047059fb83a255d89990a5b366410f51d23792 +size 23259 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index 80f122b6..62d689b2 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d2231f4d2a4b46f8a7daa258e14487b5ee0c0d6ed602fa256de0ef9cdd04f188 -size 106160 +oid sha256:f27623f7de4cd3ffafc332f52d32f9d58031dad0ba48c3954472553188926618 +size 106253 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index 699c604a..c2a34afc 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4ecdd1c9e06062da33fac4c12ca5f4011e86800bee678d985f6c95066e281d1 -size 14831 +oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 +size 14948 diff --git a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset index 56bddfc9..7759cc15 100644 --- a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset +++ b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a8777c01491888bba9f40eda9d2bed76a611f0e80f75917501ce69c1a321342 -size 47333 +oid sha256:a34dc965cab9faa793895f1015563f0440389135257bb3e9682863c87e3cdae1 +size 47710 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp new file mode 100644 index 00000000..1ad9fad0 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp @@ -0,0 +1,122 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "OverloadModule.h" + +#include "BehaviorTree/BTCompositeNode.h" +#include "Components/SphereComponent.h" +#include "GameFramework/Character.h" + +void AOverloadModule::BeginPlay() +{ + Super::BeginPlay(); + + this->SetActorTickInterval(0.2); + PlayerChar = GetWorld()->GetFirstPlayerController()->GetCharacter(); + PlayerCam = Cast(PlayerChar->GetComponentByClass(UCameraComponent::StaticClass())); +} + + +void AOverloadModule::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + CheckForPotentialHackTarget(); +} + +void AOverloadModule::CheckForPotentialHackTarget() +{ + FHitResult OutHit; + FVector LT_Start = PlayerCam->GetComponentLocation(); + FVector LT_End = PlayerCam->GetComponentLocation() + (PlayerCam->GetForwardVector() * DeadBodyCheckDistance); + + DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Red, false, 0.2, 0, 1); + + if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera) || !(OutHit.GetActor()->ActorHasTag(FName("Enemy")) && OutHit.GetActor()->ActorHasTag(FName("Dead")))) + { + PotentialHackTarget = nullptr; + DisplayNeedADeadEnemy(); + return; + } + + if (HackedEnemies.Contains(OutHit.GetActor()->GetUniqueID())) + { + PotentialHackTarget = nullptr; + DisplayAlreadyHacked(); + } + + DrawDebugLine(GetWorld(), LT_Start, OutHit.ImpactPoint, FColor::Green, false, 0.2, 0, 1); + PotentialHackTarget = OutHit.GetActor(); + DisplayFoundPotentialTarget(); +} + + +void AOverloadModule::Activate() +{ + if (GadgetCantBeUsed() || !IsValid(PotentialHackTarget)) return; + + Super::Activate(); + HackedEnemies.Add(PotentialHackTarget->GetUniqueID()); + ExplodeClosestAliveEnemy(); +} + +void AOverloadModule::FinishedUsing() +{ + Super::FinishedUsing(); +} + +void AOverloadModule::ExplodeClosestAliveEnemy() +{ + FActorSpawnParameters SpawnParams; + SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + AActor* SphereCollisionActor = GetWorld()->SpawnActor(USphereComponent::StaticClass(), PlayerChar->GetActorLocation(), PlayerChar->GetActorRotation(), SpawnParams); + USphereComponent* SphereCollision = Cast(SphereCollisionActor); + + SphereCollision->SetHiddenInGame(false); + SphereCollision->SetSphereRadius(AreaOfEffectInMeters * 100, true); + + TArray OverlappingActors; + TArray EnemiesInRadius; + + // Find all living enemies within the radius + SphereCollision->GetOverlappingActors(OverlappingActors, ACharacter::StaticClass()); + for (AActor* OverlappingActor : OverlappingActors) + { + if (OverlappingActor->ActorHasTag(FName("Enemy")) && !OverlappingActor->ActorHasTag(FName("Dead"))) EnemiesInRadius.Add(OverlappingActor); + } + + if (EnemiesInRadius.IsEmpty()) + { + DisplayFailedToFindTarget(); + return; + } + + // Find the closest Enemy in radius + AActor* ClosestEnemy = EnemiesInRadius[0]; + float Dist = FVector::Distance(PlayerChar->GetActorLocation(), ClosestEnemy->GetActorLocation()); + UE_LOG(LogTemp, Warning, TEXT("Distacne To first Considered Enemy = %f"), Dist); + if (EnemiesInRadius.Num() < 2) + { + SpawnExplosiveOnActor(ClosestEnemy, SpawnParams); + return; + } + + for (int i = 1; i < EnemiesInRadius.Num(); i++) + { + float ConsideredDist = FVector::Distance(PlayerChar->GetActorLocation(), EnemiesInRadius[i]->GetActorLocation()); + if (ConsideredDist <= Dist) + { + ClosestEnemy = EnemiesInRadius[i]; + Dist = ConsideredDist; + } + } + + SpawnExplosiveOnActor(ClosestEnemy, SpawnParams); + +} + +void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode, FActorSpawnParameters SpawnParams) +{ + GetWorld()->SpawnActor(Explosive, ActortoExplode->GetActorLocation(), ActortoExplode->GetActorRotation(), SpawnParams); +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h new file mode 100644 index 00000000..7dbfcb41 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h @@ -0,0 +1,64 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Camera/CameraComponent.h" +#include "EndlessVendetta/GadgetSystem/CombatGadget.h" +#include "EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h" +#include "OverloadModule.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API AOverloadModule : public ACombatGadget +{ + GENERATED_BODY() + + ACharacter* PlayerChar; + + UCameraComponent* PlayerCam; + + AActor* PotentialHackTarget; + + // An Array of previously hacked enemies, stops player from hacking the same Dead Enemy + TArray HackedEnemies; + + virtual void BeginPlay() override; + + virtual void Tick(float DeltaSeconds) override; + + virtual void Activate() override; + + virtual void FinishedUsing() override; + + void CheckForPotentialHackTarget(); + + void ExplodeClosestAliveEnemy(); + + void SpawnExplosiveOnActor(AActor* ActortoExplode, FActorSpawnParameters SpawnParams); + +protected: + UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + float AreaOfEffectInMeters = 15; + + UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + float DeadBodyCheckDistance = 300; + + UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + TSubclassOf Explosive; + +// --------------- Display Functions --------------- + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayAlreadyHacked(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayNeedADeadEnemy(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayFoundPotentialTarget(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayFailedToFindTarget(); +}; From 588b2e5a91c4991e97dfacb0bb4ca8b3b8c6a6f8 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Fri, 6 Oct 2023 18:27:57 +0100 Subject: [PATCH 15/26] Implemented a Generic Explosive Class --- .../Content/Gadgets/BP_Explosive.uasset | 3 ++ .../GadgetClasses/Combat/Explosive.cpp | 29 +++++++++++++++++++ .../GadgetClasses/Combat/Explosive.h | 26 +++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 EndlessVendetta/Content/Gadgets/BP_Explosive.uasset create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h diff --git a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset new file mode 100644 index 00000000..e4a28dde --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c546719195bfec717a1ea448ffd23e7eea15b3997b28a7bec6582c82fd6e0889 +size 16032 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp new file mode 100644 index 00000000..5f36be4b --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp @@ -0,0 +1,29 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Explosive.h" + +// Sets default values +AExplosive::AExplosive() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void AExplosive::BeginPlay() +{ + Super::BeginPlay(); + + UE_LOG(LogTemp, Warning, TEXT("An explosive has Spawned in ;)")); + +} + +// Called every frame +void AExplosive::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h new file mode 100644 index 00000000..b2c9f019 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "Explosive.generated.h" + +UCLASS() +class ENDLESSVENDETTA_API AExplosive : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + AExplosive(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +}; From 6bcc703974f0f748ecbdf16e07edeefc8dd8254b Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Fri, 6 Oct 2023 19:58:51 +0100 Subject: [PATCH 16/26] Started Working on UI for Overload Module --- .../Content/Gadgets/BP_DeadEnemy.uasset | 4 +-- .../Content/Gadgets/BP_Explosive.uasset | 4 +-- .../OverloadModule/CG_OverloadModule.uasset | 4 +-- .../OverloadModule/WBP_OM_ScreenWidget.uasset | 3 ++ .../Content/Gadgets/GM_GadgetManager.uasset | 4 +-- .../Content/Levels/GadgetSystemTestLevel.umap | 2 +- .../Blueprints/Blueprint_CeilingLight.uasset | 4 +-- .../Props/MaterialSphere.uasset | 4 +-- .../Combat/OverloadModule/OverloadModule.cpp | 28 +++++++++++-------- .../Combat/OverloadModule/OverloadModule.h | 9 ++++-- 10 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset diff --git a/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset b/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset index bbf47748..934ef0f7 100644 --- a/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset +++ b/EndlessVendetta/Content/Gadgets/BP_DeadEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f28b60c8b026af2e9c599996f99ccc333e23e38bac7fcaf83d345bb48703edf -size 28631 +oid sha256:45e0a403f0bfb807fb6b6b3fe987c02e2f1f79af908507e8071a0c6259d64ed1 +size 28624 diff --git a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset index e4a28dde..7589b28e 100644 --- a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset +++ b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c546719195bfec717a1ea448ffd23e7eea15b3997b28a7bec6582c82fd6e0889 -size 16032 +oid sha256:f28aca2e17c3afa2dd55c79b5f66c1ea851dd8067e0712fbc9677ca614f8c927 +size 16005 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset index 4d8790c5..1093b52a 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d61bb4d0a3f7c25b8901699a8047059fb83a255d89990a5b366410f51d23792 -size 23259 +oid sha256:599c54946bc53ff3d3ee06fc5c1e8322aa69d8a54380df1e8a63a41c5aefed46 +size 22249 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset new file mode 100644 index 00000000..042d528a --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fa538706ad1bf961d40e82afa4e2ff2937e4377d353f0db4b46cd1599609d19 +size 25427 diff --git a/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset b/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset index 3f170b83..b227979b 100644 --- a/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset +++ b/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:654adc50d788c8fb0546796c4a290967958f12c156d3a135034339350831dba6 -size 22655 +oid sha256:5aba529a9880bd712825883152d7ea40ba2c5e309dbd8d783942cdcb1e1879bf +size 22674 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index 62d689b2..83fabf6e 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f27623f7de4cd3ffafc332f52d32f9d58031dad0ba48c3954472553188926618 +oid sha256:35b4a02d71c80d38b36dd3e41dcc099477704b99bd7e2785129503a80a20e67e size 106253 diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index c5c3b84e..d5c9196d 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331 -size 158206 +oid sha256:b6a5543ffe1a37190e943bef495c0b5c55b3170e3609ac120b2b0197825e858d +size 43745 diff --git a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset index 7759cc15..56bddfc9 100644 --- a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset +++ b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a34dc965cab9faa793895f1015563f0440389135257bb3e9682863c87e3cdae1 -size 47710 +oid sha256:3a8777c01491888bba9f40eda9d2bed76a611f0e80f75917501ce69c1a321342 +size 47333 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp index 1ad9fad0..5e29360d 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp @@ -30,9 +30,11 @@ void AOverloadModule::CheckForPotentialHackTarget() FVector LT_Start = PlayerCam->GetComponentLocation(); FVector LT_End = PlayerCam->GetComponentLocation() + (PlayerCam->GetForwardVector() * DeadBodyCheckDistance); - DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Red, false, 0.2, 0, 1); - - if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera) || !(OutHit.GetActor()->ActorHasTag(FName("Enemy")) && OutHit.GetActor()->ActorHasTag(FName("Dead")))) + //DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Red, false, 0.2, 0, 1); + + FCollisionQueryParams QueryParams = FCollisionQueryParams::DefaultQueryParam; + QueryParams.AddIgnoredActor(PlayerChar); + if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams) || !(OutHit.GetActor()->ActorHasTag(FName("Enemy")) && OutHit.GetActor()->ActorHasTag(FName("Dead")))) { PotentialHackTarget = nullptr; DisplayNeedADeadEnemy(); @@ -41,11 +43,13 @@ void AOverloadModule::CheckForPotentialHackTarget() if (HackedEnemies.Contains(OutHit.GetActor()->GetUniqueID())) { + UE_LOG(LogTemp, Warning, TEXT("Enemy has already been hacked!")); PotentialHackTarget = nullptr; DisplayAlreadyHacked(); + return; } - DrawDebugLine(GetWorld(), LT_Start, OutHit.ImpactPoint, FColor::Green, false, 0.2, 0, 1); + //DrawDebugLine(GetWorld(), LT_Start, OutHit.ImpactPoint, FColor::Green, false, 0.2, 0, 1); PotentialHackTarget = OutHit.GetActor(); DisplayFoundPotentialTarget(); } @@ -58,6 +62,7 @@ void AOverloadModule::Activate() Super::Activate(); HackedEnemies.Add(PotentialHackTarget->GetUniqueID()); ExplodeClosestAliveEnemy(); + PlayHackingAnim(GadgetMaxUptime); } void AOverloadModule::FinishedUsing() @@ -67,10 +72,8 @@ void AOverloadModule::FinishedUsing() void AOverloadModule::ExplodeClosestAliveEnemy() { - FActorSpawnParameters SpawnParams; - SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - AActor* SphereCollisionActor = GetWorld()->SpawnActor(USphereComponent::StaticClass(), PlayerChar->GetActorLocation(), PlayerChar->GetActorRotation(), SpawnParams); - USphereComponent* SphereCollision = Cast(SphereCollisionActor); + FTransform EmptyTransform; + USphereComponent* SphereCollision = Cast(AddComponentByClass(USphereComponent::StaticClass(), false, EmptyTransform, false)); SphereCollision->SetHiddenInGame(false); SphereCollision->SetSphereRadius(AreaOfEffectInMeters * 100, true); @@ -94,10 +97,9 @@ void AOverloadModule::ExplodeClosestAliveEnemy() // Find the closest Enemy in radius AActor* ClosestEnemy = EnemiesInRadius[0]; float Dist = FVector::Distance(PlayerChar->GetActorLocation(), ClosestEnemy->GetActorLocation()); - UE_LOG(LogTemp, Warning, TEXT("Distacne To first Considered Enemy = %f"), Dist); if (EnemiesInRadius.Num() < 2) { - SpawnExplosiveOnActor(ClosestEnemy, SpawnParams); + SpawnExplosiveOnActor(ClosestEnemy); return; } @@ -111,12 +113,14 @@ void AOverloadModule::ExplodeClosestAliveEnemy() } } - SpawnExplosiveOnActor(ClosestEnemy, SpawnParams); + SpawnExplosiveOnActor(ClosestEnemy); } -void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode, FActorSpawnParameters SpawnParams) +void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode) { + FActorSpawnParameters SpawnParams; + SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; GetWorld()->SpawnActor(Explosive, ActortoExplode->GetActorLocation(), ActortoExplode->GetActorRotation(), SpawnParams); } diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h index 7dbfcb41..63e5d40f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h @@ -37,14 +37,14 @@ class ENDLESSVENDETTA_API AOverloadModule : public ACombatGadget void ExplodeClosestAliveEnemy(); - void SpawnExplosiveOnActor(AActor* ActortoExplode, FActorSpawnParameters SpawnParams); + void SpawnExplosiveOnActor(AActor* ActortoExplode); protected: UPROPERTY(EditDefaultsOnly, Category = "Overload Module") - float AreaOfEffectInMeters = 15; + float AreaOfEffectInMeters = 20; UPROPERTY(EditDefaultsOnly, Category = "Overload Module") - float DeadBodyCheckDistance = 300; + float DeadBodyCheckDistance = 250; UPROPERTY(EditDefaultsOnly, Category = "Overload Module") TSubclassOf Explosive; @@ -61,4 +61,7 @@ protected: UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") void DisplayFailedToFindTarget(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void PlayHackingAnim(float Loadingtime); }; From 56df964103b3d863c6cbfef0b9e7d3e24be68daf Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sat, 7 Oct 2023 13:21:35 +0100 Subject: [PATCH 17/26] Fixed Sphere Component not Despawning After Using OM --- .../StarterContent/Blueprints/Blueprint_CeilingLight.uasset | 2 +- .../GadgetClasses/Combat/OverloadModule/OverloadModule.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index d5c9196d..ed6b3cec 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6a5543ffe1a37190e943bef495c0b5c55b3170e3609ac120b2b0197825e858d +oid sha256:5af4fcb65090d7e479af3da106bf123a1282a271ff955a9c739e901b15550f74 size 43745 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp index 5e29360d..c2a7e14a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp @@ -91,6 +91,7 @@ void AOverloadModule::ExplodeClosestAliveEnemy() if (EnemiesInRadius.IsEmpty()) { DisplayFailedToFindTarget(); + SphereCollision->DestroyComponent(); return; } @@ -100,6 +101,7 @@ void AOverloadModule::ExplodeClosestAliveEnemy() if (EnemiesInRadius.Num() < 2) { SpawnExplosiveOnActor(ClosestEnemy); + SphereCollision->DestroyComponent(); return; } @@ -114,6 +116,7 @@ void AOverloadModule::ExplodeClosestAliveEnemy() } SpawnExplosiveOnActor(ClosestEnemy); + SphereCollision->DestroyComponent(); } From 8b903255028fe4e08f4b547cff67675f3594c303 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sat, 7 Oct 2023 16:40:58 +0100 Subject: [PATCH 18/26] Implemented Overload Modules UI --- .../OverloadModule/CG_OverloadModule.uasset | 4 ++-- .../OverloadModule/WBP_OM_ScreenWidget.uasset | 4 ++-- .../Content/Levels/GadgetSystemTestLevel.umap | 4 ++-- .../Blueprints/Blueprint_CeilingLight.uasset | 4 ++-- .../Particles/P_Ambient_Dust.uasset | 4 ++-- .../Combat/OverloadModule/OverloadModule.cpp | 14 ++++++++------ .../Combat/OverloadModule/OverloadModule.h | 16 ++++++++++++---- 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset index 1093b52a..d42d8a1b 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:599c54946bc53ff3d3ee06fc5c1e8322aa69d8a54380df1e8a63a41c5aefed46 -size 22249 +oid sha256:9fccd918d154abe44f38ff143101e53cd24b3e942af805172cf6ffe84b7e7cb3 +size 109934 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset index 042d528a..f48c5af0 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/WBP_OM_ScreenWidget.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fa538706ad1bf961d40e82afa4e2ff2937e4377d353f0db4b46cd1599609d19 -size 25427 +oid sha256:2ca74a9a4b471019294bae3731c5b9d96eedd3ef09a2c877a7b0966457437f6c +size 260939 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index 83fabf6e..13687f71 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35b4a02d71c80d38b36dd3e41dcc099477704b99bd7e2785129503a80a20e67e -size 106253 +oid sha256:04bfe587aa943c22a21e10962ddfb29aa185a165a9b1862aebbb012c532e5b8f +size 108254 diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index ed6b3cec..c5c3b84e 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5af4fcb65090d7e479af3da106bf123a1282a271ff955a9c739e901b15550f74 -size 43745 +oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331 +size 158206 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index bf2e4391..83fc36f9 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d -size 43456 +oid sha256:2e1b3cefe3e87cb6c0a3e14276cb1104cde7923ebc7cf5b6c77d028d3d08bf5a +size 53268 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp index c2a7e14a..acadde39 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp @@ -3,7 +3,6 @@ #include "OverloadModule.h" -#include "BehaviorTree/BTCompositeNode.h" #include "Components/SphereComponent.h" #include "GameFramework/Character.h" @@ -21,6 +20,7 @@ void AOverloadModule::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); + if (GadgetCantBeUsed()) return; CheckForPotentialHackTarget(); } @@ -67,7 +67,10 @@ void AOverloadModule::Activate() void AOverloadModule::FinishedUsing() { + IsValid(ClosestEnemy) ? DisplayHackingSuccess() : DisplayHackingFailure(); + SpawnExplosiveOnActor(ClosestEnemy); Super::FinishedUsing(); + PlayRechargingAnim(CooldownTime); } void AOverloadModule::ExplodeClosestAliveEnemy() @@ -90,17 +93,16 @@ void AOverloadModule::ExplodeClosestAliveEnemy() if (EnemiesInRadius.IsEmpty()) { - DisplayFailedToFindTarget(); + ClosestEnemy = nullptr; SphereCollision->DestroyComponent(); return; } // Find the closest Enemy in radius - AActor* ClosestEnemy = EnemiesInRadius[0]; + ClosestEnemy = EnemiesInRadius[0]; float Dist = FVector::Distance(PlayerChar->GetActorLocation(), ClosestEnemy->GetActorLocation()); if (EnemiesInRadius.Num() < 2) { - SpawnExplosiveOnActor(ClosestEnemy); SphereCollision->DestroyComponent(); return; } @@ -114,14 +116,14 @@ void AOverloadModule::ExplodeClosestAliveEnemy() Dist = ConsideredDist; } } - - SpawnExplosiveOnActor(ClosestEnemy); + SphereCollision->DestroyComponent(); } void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode) { + if (!IsValid(ActortoExplode)) return; FActorSpawnParameters SpawnParams; SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; GetWorld()->SpawnActor(Explosive, ActortoExplode->GetActorLocation(), ActortoExplode->GetActorRotation(), SpawnParams); diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h index 63e5d40f..59ffdd3a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.h @@ -22,6 +22,8 @@ class ENDLESSVENDETTA_API AOverloadModule : public ACombatGadget AActor* PotentialHackTarget; + AActor* ClosestEnemy; + // An Array of previously hacked enemies, stops player from hacking the same Dead Enemy TArray HackedEnemies; @@ -58,10 +60,16 @@ protected: UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") void DisplayFoundPotentialTarget(); - - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") - void DisplayFailedToFindTarget(); - + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") void PlayHackingAnim(float Loadingtime); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayHackingFailure(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayHackingSuccess(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void PlayRechargingAnim(float RechargingTime); }; From 3c75d16e4b6571eafa7e4252be895c354009e727 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 8 Oct 2023 14:51:11 +0100 Subject: [PATCH 19/26] Added working ammo count to all weapons --- .../AssaultRifles/BP_BaseAssaultRifle.uasset | 4 +- .../HDRI/HDRI_Epic_Courtyard_Daylight.uasset | 2 +- .../WeaponSystem/BaseWeaponClass.cpp | 48 +++++++++++-------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index bda0660d..f0a16367 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b3aee8c3c553b35b2e127ddd7dd44974fda5563ad4eb9bc18a34efceee4d004 -size 37850 +oid sha256:99fdc6f5e7c67d7a44ca185fad64f6c99ad6142011c9de4566761ec07bdd68d0 +size 37860 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index 48901753..a76d9a83 100644 --- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset +++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f245999e23fa99035343927a6662fb51718dfc13fbb549ffb43d3f94b47e375 +oid sha256:35965626ed27917622aa4630a23b7a047248cb9b9b0e66e1843969c4b1e0aadb size 66790690 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index b0ff8a20..5a282ae0 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -134,29 +134,39 @@ void ABaseWeaponClass::CancelFire() void ABaseWeaponClass::Fire() { - //do damage fallof based off distance - FHitResult outHit; - FVector traceStart; - FVector traceEnd; - traceStart = GunStartArrow->GetComponentLocation(); - traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); - FCollisionQueryParams collisionParams; - collisionParams.AddIgnoredActor(playerInWorld); - collisionParams.AddIgnoredActor(this); - if (GetWorldTimerManager().IsTimerActive(timerHandle)) + if(MagazineSize > 0) { - return; + //do damage fallof based off distance + FHitResult outHit; + FVector traceStart; + FVector traceEnd; + traceStart = GunStartArrow->GetComponentLocation(); + traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); + FCollisionQueryParams collisionParams; + collisionParams.AddIgnoredActor(playerInWorld); + collisionParams.AddIgnoredActor(this); + if (GetWorldTimerManager().IsTimerActive(timerHandle)) + { + return; + } + GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); + //Debug line to see where the trace hit + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); + playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); + MagazineSize -= 1; + UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), MagazineSize); + GenerateRecoilVector(); + ClickDetectionTimer(); + if (outHit.bBlockingHit) + { + UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); + } } - GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); - //Debug line to see where the trace hit - DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); - playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); - GenerateRecoilVector(); - ClickDetectionTimer(); - if (outHit.bBlockingHit) + else if(MagazineSize <= 0) { - UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); + UE_LOG(LogTemp, Display, TEXT("No ammo, Ammo count: %d"), MagazineSize); } + } void ABaseWeaponClass::WeaponScopedFire() From 0e401a6f62531b713ec50bb7eafa4f7856e44c07 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 8 Oct 2023 15:06:31 +0100 Subject: [PATCH 20/26] Added reload functionality for all current and future weapons --- .../Blueprints/BP_FirstPersonCharacter.uasset | 4 ++-- .../Input/Actions/IA_Reload.uasset | 3 +++ .../FirstPerson/Input/IMC_Default.uasset | 4 ++-- .../EndlessVendettaCharacter.cpp | 15 ++++++++++++ .../EndlessVendettaCharacter.h | 6 +++++ .../WeaponSystem/BaseWeaponClass.cpp | 23 +++++++++++++++---- .../WeaponSystem/BaseWeaponClass.h | 5 ++++ 7 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Reload.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 441dabb0..18599c44 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff90caf01f6ea20dccd612ea5629215ce5c5a4a63e4da2ec242cabf9000bd6c6 -size 42353 +oid sha256:a408fa1c344f5612f1ed59bfeefbd99f2fc986c49f66bf42e849db73e65fdc2e +size 42307 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Reload.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Reload.uasset new file mode 100644 index 00000000..5ed3f2f9 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Reload.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85ff514d76166f7c202ee64b678abe6314dcc24d3d662883b53edb7608ea2bfe +size 1647 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset index bb4e7fab..4cea87c6 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a0af94b654f58c85c8b4453fa211608ecc7bc67b9c82e2e3768814e906babcd -size 16334 +oid sha256:ff3f732c27d0c0064f659482af85f116bc5eb967b29d3ca42bdc2324c3662cd8 +size 16910 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 93a21cd9..fa579aa4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -91,6 +91,9 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::FireCaller); EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::GunRightClick); EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopGunRightClick); + + //Weapon Reloading + EnhancedInputComponent->BindAction(GunReloadAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::GunReload); } } @@ -256,6 +259,18 @@ void AEndlessVendettaCharacter::StopGunRightClick() } } +void AEndlessVendettaCharacter::GunReload() +{ + if (IsValid(PrimaryWeapon)) + { + PrimaryWeapon->WeaponReload(); + } + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->WeaponReload(); + } +} + void AEndlessVendettaCharacter::Move(const FInputActionValue& Value) { diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 8762426a..fdd1718f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -61,6 +61,9 @@ class AEndlessVendettaCharacter : public ACharacter UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) class UInputAction* GunAimInAction; + + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) + class UInputAction* GunReloadAction; public: AEndlessVendettaCharacter(); @@ -109,6 +112,9 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void StopGunRightClick(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void GunReload(); + UArrowComponent* ScopedLocationArrow; UPROPERTY(EditAnywhere, Category = "Dont Touch") diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 5a282ae0..65dcbc96 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -44,6 +44,10 @@ void ABaseWeaponClass::BeginPlay() originalMaxAngleLeft = recoilMaxAngleLeft; originalMaxAngleRight = recoilMaxAngleRight; originalMinMultiplier = recoilMinMultiplier; + + currentAmmoCount = MagazineSize; + + UE_LOG(LogTemp, Display, TEXT("crnnt ammo: %d"), MagazineSize); } // Called every frame @@ -134,7 +138,7 @@ void ABaseWeaponClass::CancelFire() void ABaseWeaponClass::Fire() { - if(MagazineSize > 0) + if(currentAmmoCount > 0) { //do damage fallof based off distance FHitResult outHit; @@ -153,8 +157,8 @@ void ABaseWeaponClass::Fire() //Debug line to see where the trace hit DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); - MagazineSize -= 1; - UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), MagazineSize); + currentAmmoCount -= 1; + UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), currentAmmoCount); GenerateRecoilVector(); ClickDetectionTimer(); if (outHit.bBlockingHit) @@ -162,9 +166,9 @@ void ABaseWeaponClass::Fire() UE_LOG(LogTemp, Display, TEXT("hit item: %s"), *outHit.GetActor()->GetName()); } } - else if(MagazineSize <= 0) + else if(currentAmmoCount <= 0) { - UE_LOG(LogTemp, Display, TEXT("No ammo, Ammo count: %d"), MagazineSize); + UE_LOG(LogTemp, Display, TEXT("No ammo, Ammo count: %d"), currentAmmoCount); } } @@ -188,4 +192,13 @@ void ABaseWeaponClass::WeaponScopedFire() } } +void ABaseWeaponClass::WeaponReload() +{ + if(MagazineSize > currentAmmoCount) + { + UE_LOG(LogTemp, Display, TEXT("Weapon Reloading: mag size: %d"), MagazineSize); + currentAmmoCount = MagazineSize; + } +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 8eb2d617..1d07fb65 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -110,6 +110,9 @@ public: UFUNCTION(BlueprintCallable, Category = "Weapons") void WeaponScopedFire(); + UFUNCTION(BlueprintCallable, Category = "Weapons") + void WeaponReload(); + private: UArrowComponent* GunStartArrow; @@ -121,5 +124,7 @@ private: float originalMaxAngleLeft; float originalMaxAngleRight; float originalMinMultiplier; + + int currentAmmoCount; }; From 877f485fa48b601b740f2f574180068fa05f3848 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 12:02:54 +0100 Subject: [PATCH 21/26] Added Starter Pack Explosion Effect to Explosion BP --- EndlessVendetta/Content/Gadgets/BP_Explosive.uasset | 4 ++-- .../StarterContent/Blueprints/Blueprint_CeilingLight.uasset | 4 ++-- .../Content/StarterContent/Particles/P_Ambient_Dust.uasset | 4 ++-- EndlessVendetta/Content/UI/UI_Material_SeeThroughWalls.uasset | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset index 7589b28e..6bac451c 100644 --- a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset +++ b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f28aca2e17c3afa2dd55c79b5f66c1ea851dd8067e0712fbc9677ca614f8c927 -size 16005 +oid sha256:f5563c101f81066dbb41a0b754402e01042647fdcf549bbdeeec92f0439b3230 +size 31653 diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index c5c3b84e..0241ee15 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331 -size 158206 +oid sha256:085d78ef65ab97ec078a500205fb10f2b817ac92df05022c1c3c6e921dea9bb8 +size 43745 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index 83fc36f9..bf2e4391 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e1b3cefe3e87cb6c0a3e14276cb1104cde7923ebc7cf5b6c77d028d3d08bf5a -size 53268 +oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d +size 43456 diff --git a/EndlessVendetta/Content/UI/UI_Material_SeeThroughWalls.uasset b/EndlessVendetta/Content/UI/UI_Material_SeeThroughWalls.uasset index c3067fb0..06d1c788 100644 --- a/EndlessVendetta/Content/UI/UI_Material_SeeThroughWalls.uasset +++ b/EndlessVendetta/Content/UI/UI_Material_SeeThroughWalls.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a38d567de25b3df88bbe21626983ee66de938d460d4c22aabc81f9790376222 -size 14569 +oid sha256:3439980aab6831afe77137df063f00b63258da0e3ba5c3c8b84a00e86c48bbf9 +size 15025 From 9d36fa784695522893876f22a6f1530d64422ddd Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 16:19:26 +0100 Subject: [PATCH 22/26] Implemented Explosive Functionality Needs to be linked with AI TakeDamage when everything is merged --- .../Content/Gadgets/BP_Explosive.uasset | 3 - .../Content/Gadgets/BP_Grenade.uasset | 3 + .../OverloadModule/BP_OM_Explosive.uasset | 3 + .../OverloadModule/CG_OverloadModule.uasset | 4 +- .../Content/Levels/GadgetSystemTestLevel.umap | 2 +- .../Architecture/Floor_400x400.uasset | 4 +- .../Blueprints/Blueprint_CeilingLight.uasset | 4 +- .../GadgetClasses/Combat/Explosive.cpp | 62 ++++++++++++++++++- .../GadgetClasses/Combat/Explosive.h | 47 ++++++++++++-- 9 files changed, 115 insertions(+), 17 deletions(-) delete mode 100644 EndlessVendetta/Content/Gadgets/BP_Explosive.uasset create mode 100644 EndlessVendetta/Content/Gadgets/BP_Grenade.uasset create mode 100644 EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset diff --git a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset b/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset deleted file mode 100644 index 6bac451c..00000000 --- a/EndlessVendetta/Content/Gadgets/BP_Explosive.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f5563c101f81066dbb41a0b754402e01042647fdcf549bbdeeec92f0439b3230 -size 31653 diff --git a/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset b/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset new file mode 100644 index 00000000..addf3533 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ff5fde4fbfe047c25915d65585f2437dba30915a42f654972b362d236ccf6f4 +size 42440 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset new file mode 100644 index 00000000..1365a543 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:133db5845b20abcf5ffcb9bc6717757183a2440744b01ad1f038760335a5bea7 +size 40521 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset index d42d8a1b..92c1b889 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fccd918d154abe44f38ff143101e53cd24b3e942af805172cf6ffe84b7e7cb3 -size 109934 +oid sha256:7deabddf98ca24dc431c4e0f2c25ba9b0d9edf03e2637c6a3dc37a1ccf7e8068 +size 109849 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index 13687f71..f0cfe02e 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04bfe587aa943c22a21e10962ddfb29aa185a165a9b1862aebbb012c532e5b8f +oid sha256:2bc44125551b89f13cdffde72a42c09685d26b6bbaa3ce8d28858ab14d83c0dc size 108254 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..5f70301d 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:4f19f519f4b4bc1050bc5b9bf94607306785bb5773b00ddafc385746c3885373 +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset index 0241ee15..c5c3b84e 100644 --- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset +++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:085d78ef65ab97ec078a500205fb10f2b817ac92df05022c1c3c6e921dea9bb8 -size 43745 +oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331 +size 158206 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp index 5f36be4b..4476d8d4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.cpp @@ -3,6 +3,9 @@ #include "Explosive.h" +#include "CollisionDebugDrawingPublic.h" +#include "Kismet/KismetMathLibrary.h" + // Sets default values AExplosive::AExplosive() { @@ -16,8 +19,14 @@ void AExplosive::BeginPlay() { Super::BeginPlay(); - UE_LOG(LogTemp, Warning, TEXT("An explosive has Spawned in ;)")); - + if (ExplosionDelayInSeconds <= 0) + { + Explosion(); + return; + } + + FTimerHandle ExplosionHandle; + GetWorld()->GetTimerManager().SetTimer(ExplosionHandle, this, &AExplosive::Explosion, ExplosionDelayInSeconds); } // Called every frame @@ -27,3 +36,52 @@ void AExplosive::Tick(float DeltaTime) } +void AExplosive::Explosion() +{ + float PitchAngleIncrement = 180.f / ShrapnelPitchDensity; + float YawAngleIncrement = 360.f / ShrapnelYawDensity; + + FHitResult OutHit; + FCollisionQueryParams QueryParams = FCollisionQueryParams::DefaultQueryParam; + QueryParams.bTraceComplex = false; + QueryParams.AddIgnoredActor(this); + FVector LT_Start = GetActorLocation(); + + for(int y = 1; y <= ShrapnelPitchDensity; y++) + { + for (int x = 1; x <= ShrapnelYawDensity; x++) + { + FRotator ShrapnelRotation = FRotator(-90.f + (y * PitchAngleIncrement), x * YawAngleIncrement, 0.f); + FVector LT_End = LT_Start + (UKismetMathLibrary::GetForwardVector(ShrapnelRotation) * ShrapnelTravelDistance); + bool HitSomething = GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams); + + if (DrawDebugLines) DrawShrapnelDebugLines(HitSomething, LT_Start, LT_End, OutHit.ImpactPoint); + if (!HitSomething || !OutHit.GetActor()->ActorHasTag(FName("Enemy")) || OutHit.GetActor()->ActorHasTag(FName("Dead"))) continue; + + float HitDistance = FVector::Distance(LT_Start, OutHit.ImpactPoint); + float DamageToApply = ShrapnelDamage; + if (HitDistance > ShrapnelDamageFalloffDistance) + { + // Damage linearly decrease from falloff distance to maximum travel distance, using straight line equation y = mx + c + float Magnitude = ShrapnelDamage / (ShrapnelDamageFalloffDistance - ShrapnelTravelDistance); + float DMG_Intercept = ShrapnelDamage - (Magnitude * ShrapnelDamageFalloffDistance); + DamageToApply = (Magnitude * HitDistance) + DMG_Intercept; + } + // When merged, call philips take damage function here + UE_LOG(LogTemp, Warning, TEXT("A shrapnel piece hit %s, dealing %f damage"), *OutHit.GetActor()->GetName(), DamageToApply); + } + } + PlayExplosionEffects(); +} + +void AExplosive::DrawShrapnelDebugLines(bool HitSomething, FVector StartVector, FVector EndVector, FVector ImpactPoint) +{ + if (!HitSomething) + { + DrawDebugLine(GetWorld(), StartVector, EndVector, FColor::Green, false, 5, 0, 2); + return; + } + DrawDebugLine(GetWorld(), ImpactPoint, EndVector, FColor::Red, false, 5, 0, 2); + DrawDebugLine(GetWorld(), StartVector, ImpactPoint, FColor::Green, false, 5, 0, 2); +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h index b2c9f019..4ffb2806 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/Explosive.h @@ -10,16 +10,53 @@ UCLASS() class ENDLESSVENDETTA_API AExplosive : public AActor { GENERATED_BODY() - -public: - // Sets default values for this actor's properties - AExplosive(); + + void DrawShrapnelDebugLines(bool HitSomething, FVector StartVector, FVector EndVector, FVector ImpactPoint); protected: + // Maximum amount of damage dealt by an individual piece of shrapnel + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + float ShrapnelDamage = 10; + + // Number of shrapnel pieces uniformly spread around the Y axis + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + int ShrapnelPitchDensity = 40; + + // Number of shrapnel pieces uniformly spread around the Z axis + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + int ShrapnelYawDensity = 40; + + // How far shrapnel should travel from origin point, given its not obstructed along its path + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + float ShrapnelTravelDistance = 600; + + // After what distance travelled should shrapnel damage start to decrease + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + float ShrapnelDamageFalloffDistance = 200; + + // Delay from spawning in before explosion happens + UPROPERTY(EditDefaultsOnly, Category = "Explosion") + float ExplosionDelayInSeconds = 0; + + /** + * Should debug lines be drawn to show planned travel trajectory of each + * shrapnel piece in red, and actual travelled shrapnel trajectory in green + */ + UPROPERTY(EditAnywhere, Category = "Explosion") + bool DrawDebugLines = false; + + UFUNCTION(BlueprintImplementableEvent, Category = "Explosion") + void PlayExplosionEffects(); + + void Explosion(); + // Called when the game starts or when spawned virtual void BeginPlay() override; -public: +public: + // Sets default values for this actor's properties + AExplosive(); + // Called every frame virtual void Tick(float DeltaTime) override; From 2a9e30108dac66687cd408a8f54907500abddb4c Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 19:35:08 +0100 Subject: [PATCH 23/26] Implemented Ring Module Class Functionality --- .../OverloadModule/CG_OverloadModule.uasset | 4 +- .../Content/Levels/GadgetSystemTestLevel.umap | 2 +- .../Architecture/Floor_400x400.uasset | 4 +- .../Particles/P_Ambient_Dust.uasset | 4 +- .../Combat/OverloadModule/OverloadModule.cpp | 4 +- .../Recon/RingModule/RingModule.cpp | 99 +++++++++++++++++++ .../Recon/RingModule/RingModule.h | 68 +++++++++++++ 7 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset index 92c1b889..918f8800 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7deabddf98ca24dc431c4e0f2c25ba9b0d9edf03e2637c6a3dc37a1ccf7e8068 -size 109849 +oid sha256:54c29d51176ad4d6f3709487c680854c3f65197fd77c3fdf909aacebf0012925 +size 109955 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index f0cfe02e..91a8ae16 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2bc44125551b89f13cdffde72a42c09685d26b6bbaa3ce8d28858ab14d83c0dc +oid sha256:77cadba64fcbb3018eab09695343339696bd1a1fbcfb39ee13aca7d57c7b4bab size 108254 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index 5f70301d..c2a34afc 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f19f519f4b4bc1050bc5b9bf94607306785bb5773b00ddafc385746c3885373 -size 14831 +oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 +size 14948 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index bf2e4391..fd1980eb 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d -size 43456 +oid sha256:6606ee0e9ddf200d7b115f4bece31c3d00626e6eca88de44c836d32074510c65 +size 53268 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp index acadde39..c89568ee 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Combat/OverloadModule/OverloadModule.cpp @@ -43,7 +43,6 @@ void AOverloadModule::CheckForPotentialHackTarget() if (HackedEnemies.Contains(OutHit.GetActor()->GetUniqueID())) { - UE_LOG(LogTemp, Warning, TEXT("Enemy has already been hacked!")); PotentialHackTarget = nullptr; DisplayAlreadyHacked(); return; @@ -77,8 +76,7 @@ void AOverloadModule::ExplodeClosestAliveEnemy() { FTransform EmptyTransform; USphereComponent* SphereCollision = Cast(AddComponentByClass(USphereComponent::StaticClass(), false, EmptyTransform, false)); - - SphereCollision->SetHiddenInGame(false); + SphereCollision->SetSphereRadius(AreaOfEffectInMeters * 100, true); TArray OverlappingActors; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp new file mode 100644 index 00000000..941a7be1 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp @@ -0,0 +1,99 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "RingModule.h" + +#include "Components/SphereComponent.h" +#include "GameFramework/Character.h" + +void ARingModule::BeginPlay() +{ + Super::BeginPlay(); + + this->SetActorTickInterval(0.2); + PlayerChar = GetWorld()->GetFirstPlayerController()->GetCharacter(); + PlayerCam = Cast(PlayerChar->GetComponentByClass(UCameraComponent::StaticClass())); +} + +void ARingModule::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + if (GadgetCantBeUsed()) return; + CheckForPotentialHackTarget(); +} + +void ARingModule::CheckForPotentialHackTarget() +{ + FHitResult OutHit; + FVector LT_Start = PlayerCam->GetComponentLocation(); + FVector LT_End = PlayerCam->GetComponentLocation() + (PlayerCam->GetForwardVector() * DeadBodyCheckDistance); + + //DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Red, false, 0.2, 0, 1); + + FCollisionQueryParams QueryParams = FCollisionQueryParams::DefaultQueryParam; + QueryParams.AddIgnoredActor(PlayerChar); + if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams) || !(OutHit.GetActor()->ActorHasTag(FName("Enemy")) && OutHit.GetActor()->ActorHasTag(FName("Dead")))) + { + PotentialHackTarget = nullptr; + DisplayNeedADeadEnemy(); + return; + } + + if (HackedEnemies.Contains(OutHit.GetActor()->GetUniqueID())) + { + PotentialHackTarget = nullptr; + DisplayAlreadyHacked(); + return; + } + + //DrawDebugLine(GetWorld(), LT_Start, OutHit.ImpactPoint, FColor::Green, false, 0.2, 0, 1); + PotentialHackTarget = OutHit.GetActor(); + DisplayFoundPotentialTarget(); +} + + +void ARingModule::Activate() +{ + if (GadgetCantBeUsed() || !IsValid(PotentialHackTarget)) return; + + Super::Activate(); + HackedEnemies.Add(PotentialHackTarget->GetUniqueID()); + PlayHackingAnim(GadgetMaxUptime); +} + +void ARingModule::FinishedUsing() +{ + SpawnRingingPhoneForAllNearbyEnemies() ? DisplayHackingSuccess() : DisplayHackingFailure(); + Super::FinishedUsing(); + PlayRechargingAnim(CooldownTime); +} + +bool ARingModule::SpawnRingingPhoneForAllNearbyEnemies() +{ + FTransform EmptyTransform; + USphereComponent* SphereCollision = Cast(AddComponentByClass(USphereComponent::StaticClass(), false, EmptyTransform, false)); + SphereCollision->SetSphereRadius(AreaOfEffectInMeters * 100, true); + + TArray OverlappingActors; + TArray EnemiesInRadius; + + SphereCollision->GetOverlappingActors(OverlappingActors, ACharacter::StaticClass()); + for (AActor* OverlappingActor : OverlappingActors) + { + if (OverlappingActor->ActorHasTag(FName("Enemy")) && !OverlappingActor->ActorHasTag(FName("Dead"))) EnemiesInRadius.Add(OverlappingActor); + } + + if (EnemiesInRadius.IsEmpty()) + { + SphereCollision->DestroyComponent(); + return false; + } + + for (AActor* Enemy : EnemiesInRadius) + { + //Dont Forget to spawn in phone ringing + UE_LOG(LogTemp, Warning, TEXT("%s's phone is ringing!!!"), *Enemy->GetName()); + } + return true; +} diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h new file mode 100644 index 00000000..70b53f1d --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h @@ -0,0 +1,68 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "EndlessVendetta/GadgetSystem/ReconGadget.h" +#include "Camera/CameraComponent.h" +#include "RingModule.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API ARingModule : public AReconGadget +{ + GENERATED_BODY() + + ACharacter* PlayerChar; + + UCameraComponent* PlayerCam; + + AActor* PotentialHackTarget; + + // An Array of previously hacked enemies, stops player from hacking the same Dead Enemy + TArray HackedEnemies; + + virtual void BeginPlay() override; + + virtual void Tick(float DeltaSeconds) override; + + virtual void Activate() override; + + virtual void FinishedUsing() override; + + void CheckForPotentialHackTarget(); + + // Returns false if there are no nearby enemies + bool SpawnRingingPhoneForAllNearbyEnemies(); + +protected: + UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + float AreaOfEffectInMeters = 20; + + UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + float DeadBodyCheckDistance = 250; + + // --------------- Display Functions --------------- + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayAlreadyHacked(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayNeedADeadEnemy(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayFoundPotentialTarget(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void PlayHackingAnim(float Loadingtime); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayHackingFailure(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void DisplayHackingSuccess(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + void PlayRechargingAnim(float RechargingTime); +}; From 9be0b373cf8b1fffa65eca8f60638ba772e3378e Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 20:11:07 +0100 Subject: [PATCH 24/26] Implemented Ring Module UI --- .../Content/Gadgets/GM_GadgetManager.uasset | 2 +- .../RingModule/BP_RingingPhone.uasset | 3 +++ .../RingModule/RG_RingModule.uasset | 3 +++ .../RingModule/WBP_RM_ScreenWidget.uasset | 3 +++ .../Content/Levels/GadgetSystemTestLevel.umap | 2 +- .../Particles/P_Ambient_Dust.uasset | 2 +- .../Recon/RingModule/PhoneRinging.cpp | 27 +++++++++++++++++++ .../Recon/RingModule/PhoneRinging.h | 26 ++++++++++++++++++ .../Recon/RingModule/RingModule.cpp | 7 +++-- .../Recon/RingModule/RingModule.h | 22 ++++++++------- 10 files changed, 83 insertions(+), 14 deletions(-) create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/WBP_RM_ScreenWidget.uasset create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.h diff --git a/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset b/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset index b227979b..659e6cc8 100644 --- a/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset +++ b/EndlessVendetta/Content/Gadgets/GM_GadgetManager.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5aba529a9880bd712825883152d7ea40ba2c5e309dbd8d783942cdcb1e1879bf +oid sha256:101873288135db576b1a0060f9872880d1b4aaa7eca4c80cb4aa05925c67e275 size 22674 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset new file mode 100644 index 00000000..7cb176c8 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ce42b2de8dc042e66a21fbb40c537d3d9b77bf9aba08bad33b7fa9de1b684a7 +size 39014 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset new file mode 100644 index 00000000..09120a7b --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b2a5cc7e22ed47e7380506b6873eb520643402f4f229340f00de2bac9e53e58 +size 108531 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/WBP_RM_ScreenWidget.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/WBP_RM_ScreenWidget.uasset new file mode 100644 index 00000000..747ddfc3 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/WBP_RM_ScreenWidget.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffd72773986cdacf62029cebebc6b25f8a581d0270358c303b8a968c6bfd23da +size 254397 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index 91a8ae16..a43859c1 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77cadba64fcbb3018eab09695343339696bd1a1fbcfb39ee13aca7d57c7b4bab +oid sha256:253bd27498f52b503e5f65dbcad3810691d5d96581785cd5926f369155cef907 size 108254 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index fd1980eb..2d4167b3 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6606ee0e9ddf200d7b115f4bece31c3d00626e6eca88de44c836d32074510c65 +oid sha256:4d30ed0b3dca3879d9dd3b4c282293f326fc8a3b237e554c97025497362ac08c size 53268 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.cpp new file mode 100644 index 00000000..c3117259 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "PhoneRinging.h" + +// Sets default values +APhoneRinging::APhoneRinging() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void APhoneRinging::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void APhoneRinging::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.h new file mode 100644 index 00000000..dd9f8cdc --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/PhoneRinging.h @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "PhoneRinging.generated.h" + +UCLASS() +class ENDLESSVENDETTA_API APhoneRinging : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + APhoneRinging(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +}; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp index 941a7be1..d282dd8a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.cpp @@ -90,10 +90,13 @@ bool ARingModule::SpawnRingingPhoneForAllNearbyEnemies() return false; } + FActorSpawnParameters SpawnParams; + SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); for (AActor* Enemy : EnemiesInRadius) { - //Dont Forget to spawn in phone ringing - UE_LOG(LogTemp, Warning, TEXT("%s's phone is ringing!!!"), *Enemy->GetName()); + AActor* SpawnedPhone = GetWorld()->SpawnActor(PhoneRingingClass, Enemy->GetActorLocation(), Enemy->GetActorRotation(), SpawnParams); + SpawnedPhone->AttachToComponent(Enemy->GetRootComponent(), AttachmentRules); } return true; } diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h index 70b53f1d..68dfb294 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/RingModule/RingModule.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "PhoneRinging.h" #include "EndlessVendetta/GadgetSystem/ReconGadget.h" #include "Camera/CameraComponent.h" #include "RingModule.generated.h" @@ -38,31 +39,34 @@ class ENDLESSVENDETTA_API ARingModule : public AReconGadget bool SpawnRingingPhoneForAllNearbyEnemies(); protected: - UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + UPROPERTY(EditDefaultsOnly, Category = "Ring Module") float AreaOfEffectInMeters = 20; - UPROPERTY(EditDefaultsOnly, Category = "Overload Module") + UPROPERTY(EditDefaultsOnly, Category = "Ring Module") float DeadBodyCheckDistance = 250; + + UPROPERTY(EditDefaultsOnly, Category = "Ring Module") + TSubclassOf PhoneRingingClass; // --------------- Display Functions --------------- - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void DisplayAlreadyHacked(); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void DisplayNeedADeadEnemy(); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void DisplayFoundPotentialTarget(); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void PlayHackingAnim(float Loadingtime); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void DisplayHackingFailure(); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void DisplayHackingSuccess(); - UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") + UFUNCTION(BlueprintImplementableEvent, Category = "Ring Module") void PlayRechargingAnim(float RechargingTime); }; From 4ac12b8794e90c8f809d1f8fd1fbd11054184e72 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 21:12:23 +0100 Subject: [PATCH 25/26] Implemented Explosive Sound Cue to Explosions --- EndlessVendetta/Content/Gadgets/BP_Grenade.uasset | 4 ++-- .../CombatGadgets/OverloadModule/BP_OM_Explosive.uasset | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset b/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset index addf3533..92db3563 100644 --- a/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset +++ b/EndlessVendetta/Content/Gadgets/BP_Grenade.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ff5fde4fbfe047c25915d65585f2437dba30915a42f654972b362d236ccf6f4 -size 42440 +oid sha256:3b5b0aa3f0b0da4c979843a761e655ef147058bb43079f24e4ef358532a7d5cf +size 49595 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset index 1365a543..7a2cb36f 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/BP_OM_Explosive.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:133db5845b20abcf5ffcb9bc6717757183a2440744b01ad1f038760335a5bea7 -size 40521 +oid sha256:0294c0bf210acc1dbff59e7259400d9dd1c0f2a6674c2a130a5a24dd7e8d6c9d +size 49878 From 7e02028ce807b6cb22b62827e3f075fad704b6d7 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Sun, 8 Oct 2023 21:28:47 +0100 Subject: [PATCH 26/26] Added Random Temp Rigntones for Hacked Enemies --- .../Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset | 4 ++-- .../Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset | 4 ++-- .../ReconGadgets/RingModule/Ringtones/TempRingTone_1.uasset | 3 +++ .../ReconGadgets/RingModule/Ringtones/TempRingTone_2.uasset | 3 +++ .../ReconGadgets/RingModule/Ringtones/TempRingTone_4.uasset | 3 +++ .../RingModule/Ringtones/TempRingTone_Cue_1.uasset | 3 +++ .../RingModule/Ringtones/TempRingTone_Cue_2.uasset | 3 +++ .../RingModule/Ringtones/TempRingTone_Cue_4.uasset | 3 +++ .../ReconGadgets/RingModule/Ringtones/TempRingtone_3.uasset | 3 +++ .../RingModule/Ringtones/TempRingtone_Cue_3.uasset | 3 +++ EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap | 2 +- .../Content/StarterContent/Particles/P_Ambient_Dust.uasset | 4 ++-- .../Content/StarterContent/Props/MaterialSphere.uasset | 4 ++-- 13 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_1.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_2.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_4.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_1.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_2.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_4.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_3.uasset create mode 100644 EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_Cue_3.uasset diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset index 7cb176c8..c2168845 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/BP_RingingPhone.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ce42b2de8dc042e66a21fbb40c537d3d9b77bf9aba08bad33b7fa9de1b684a7 -size 39014 +oid sha256:7b98c1ddcdd17636cb29a010217910419c7674894cef53127e723f4298fb714d +size 47866 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset index 09120a7b..0ed980f6 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3b2a5cc7e22ed47e7380506b6873eb520643402f4f229340f00de2bac9e53e58 -size 108531 +oid sha256:5d874ac6c73fe2ee1d7f1024877b2f448df3daf631d5dafbf4e23804549fa652 +size 108456 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_1.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_1.uasset new file mode 100644 index 00000000..e6ba3ca4 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d35033628bd5db17cb99027efbab8c2dd473e5388fb32d34558e11e7f338c73d +size 3852614 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_2.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_2.uasset new file mode 100644 index 00000000..ec55125b --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ea010e84dc996169f39e921770477b79303bccf4bb40972f258106064245e6e +size 3386251 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_4.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_4.uasset new file mode 100644 index 00000000..93fcaa59 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_4.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8386a474ed43859781c4a531ccb1236ba402a03b4f1927ed7b5d5079f1980661 +size 3390670 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_1.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_1.uasset new file mode 100644 index 00000000..d69e0e6a --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00265bc01e803ae78c9486a50cdb2fe60b93de0d265a599dec052b079cc724c8 +size 4272 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_2.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_2.uasset new file mode 100644 index 00000000..a81042d9 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8b96750f088380206ae1d2efbe770b4257e226e91e25931200a75e0816087dc +size 4272 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_4.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_4.uasset new file mode 100644 index 00000000..526aa997 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingTone_Cue_4.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:324f88c110dc7f51d064e81abab62461b423fa3fd69926a9e5c7a03d34e143e3 +size 4272 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_3.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_3.uasset new file mode 100644 index 00000000..50d48159 --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_3.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81979a2046a7663ac4f084d2824198b887b891f2dfb2d497ba58ebf5bf89d166 +size 4030169 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_Cue_3.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_Cue_3.uasset new file mode 100644 index 00000000..6d4ddfdd --- /dev/null +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/Ringtones/TempRingtone_Cue_3.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7858b2bb4d57c53a0fa054ba19bda0f09e8c7b6bb797785be5c0e91a3ab9cb41 +size 4272 diff --git a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap index a43859c1..ee781591 100644 --- a/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap +++ b/EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:253bd27498f52b503e5f65dbcad3810691d5d96581785cd5926f369155cef907 +oid sha256:38cb9c3d251f43819b4908c0a95aff93c8c3185de87ef7051cf426b33797f636 size 108254 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index 2d4167b3..bf2e4391 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d30ed0b3dca3879d9dd3b4c282293f326fc8a3b237e554c97025497362ac08c -size 53268 +oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d +size 43456 diff --git a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset index 56bddfc9..413bf4e9 100644 --- a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset +++ b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a8777c01491888bba9f40eda9d2bed76a611f0e80f75917501ce69c1a321342 -size 47333 +oid sha256:000a98212651fd0d1c6804c7636e5e4614f710bd1a19a87b394f13dda3bcbc17 +size 47710