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();