Merge branch 'WeaponSystem' into dev

# Conflicts:
#	EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetClasses/Recon/VisionLink/VisionLinkEnemyLOSTest.cpp
This commit is contained in:
MH261677 2023-10-09 11:02:05 +01:00
commit 0f465d1631
32 changed files with 430 additions and 176 deletions

View File

@ -6,3 +6,6 @@ bAllowClassAndBlueprintPinMatching=true
bReplaceBlueprintWithClass= true
bDontLoadBlueprintOutsideEditor= true
bBlueprintIsNotBlueprintType= true
[/Script/AdvancedPreviewScene.SharedProfiles]

View File

@ -85,3 +85,6 @@ ConnectionType=USBOnly
bUseManualIPAddress=False
ManualIPAddress=
[CoreRedirects]
+PropertyRedirects=(OldName="/Script/EndlessVendetta.BaseWeaponClass.player",NewName="/Script/EndlessVendetta.BaseWeaponClass.playerInWorld")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -88,7 +88,12 @@ 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(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);
}
}
@ -139,6 +144,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->Destroy();
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
PrimaryWeapon = nullptr;
bHasRifle = false;
return;
@ -146,11 +152,9 @@ 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;
@ -164,34 +168,6 @@ void AEndlessVendettaCharacter::EquipPrimary()
//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<ABaseWeaponClass>(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<AActor>(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<ABaseWeaponClass>(PrimaryWeaponActor);
//
// }
// else if (IsValid(PrimaryWeapon))
// {
// PrimaryWeapon->Destroy();
// bHasRifle = false;
// }
}
void AEndlessVendettaCharacter::EquipSecondary()
@ -199,6 +175,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->Destroy();
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
SecondaryWeapon = nullptr;
bHasRifle = false;
return;
@ -206,11 +183,9 @@ void AEndlessVendettaCharacter::EquipSecondary()
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;
@ -220,74 +195,81 @@ void AEndlessVendettaCharacter::EquipSecondary()
AActor* SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
SecondaryWeapon = Cast<ABaseWeaponClass>(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<AActor>(SecondaryWeaponClass, spawnParams);
// SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
// SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
// }
// else if (IsValid(SecondaryWeapon))
// {
// SecondaryWeapon->Destroy();
// bHasRifle = false;
// }
}
//Calls the fire function in the baseWeaponClass
void AEndlessVendettaCharacter::TapFireCaller()
void AEndlessVendettaCharacter::FireCaller()
{
UE_LOG(LogTemp, Warning, TEXT("Tap Fire"));
// if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon))
// {
// PrimaryWeaponClass.GetDefaultObject()->TapFire();
// }
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->Fire();
}
if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->Fire();
}
}
//POTENTIAL PICKUP SYSTEM NEEDS CHANGING BUT YES
//Called from Player BluePrints
/*void AEndlessVendettaCharacter::WeaponPickUpSystem(AActor* PickedUpWeapon)
void AEndlessVendettaCharacter::GunRightClick()
{
ABaseWeaponClass* WeaponInWorld = Cast<ABaseWeaponClass>(PickedUpWeapon);
if(WeaponInWorld->IsA(ABaseWeaponClass::StaticClass()))
if (IsValid(PrimaryWeapon) && !bIsScoped)
{
if(PrimaryWeapon)
for (UActorComponent* actorComp : this->GetComponentsByTag(UArrowComponent::StaticClass(), FName("ScopedLocationArrow")))
{
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<ABaseWeaponClass>(GetWorld()->SpawnActor<AActor>(PrimaryWeapon, loc, rot, spawnParams));
WeaponInWorld->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
WeaponInWorld->Destroy();
ScopedLocationArrow = Cast<UArrowComponent>(actorComp);
break;
}
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) && !bIsScoped)
{
for (UActorComponent* actorComp : this->GetComponentsByTag(UArrowComponent::StaticClass(), FName("ScopedLocationArrow")))
{
ScopedLocationArrow = Cast<UArrowComponent>(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
}
}
//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()))
void AEndlessVendettaCharacter::StopGunRightClick()
{
if (IsValid(PrimaryWeapon))
{
if(SecondaryWeapon)
bIsScoped = false;
PrimaryWeapon->WeaponScopedFire();
PrimaryWeapon->SetActorRelativeLocation(FVector(0,0,0));
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
}
if (IsValid(SecondaryWeapon))
{
UE_LOG(LogTemp, Display, TEXT("Secondary Weapon Picked up"));
bIsScoped = false;
SecondaryWeapon->WeaponScopedFire();
SecondaryWeapon->SetActorRelativeLocation(FVector(0,0,0));
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
}
}
void AEndlessVendettaCharacter::GunReload()
{
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->WeaponReload();
}
if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->WeaponReload();
}
}*/
}
void AEndlessVendettaCharacter::Move(const FInputActionValue& Value)

View File

@ -60,7 +60,10 @@ class AEndlessVendettaCharacter : public ACharacter
class UInputAction* TapShootAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
class UInputAction* HoldShootAction;
class UInputAction* GunAimInAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
class UInputAction* GunReloadAction;
public:
AEndlessVendettaCharacter();
@ -101,8 +104,21 @@ public:
ABaseWeaponClass* SecondaryWeapon;
UFUNCTION(BlueprintCallable, Category = "Weapons")
void TapFireCaller();
void FireCaller();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void GunRightClick();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void StopGunRightClick();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void GunReload();
UArrowComponent* ScopedLocationArrow;
UPROPERTY(EditAnywhere, Category = "Dont Touch")
bool bIsScoped;
protected:
/** Called for movement input */
@ -119,9 +135,6 @@ protected:
void EquipSecondary();
//Called from Player BluePrints
//UFUNCTION(BlueprintCallable, Category = "Weapons")
//void WeaponPickUpSystem(AActor* PickedUpWeapon);
protected:
// APawn interface
@ -134,5 +147,6 @@ public:
/** Returns FirstPersonCameraComponent subobject **/
UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; }
};

View File

@ -60,12 +60,11 @@ void AVisionLinkEnemyLOSTest::TestLOS(TArray<uint32> EnemiesInLink, AActor* LOSA
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);
UE_LOG(LogTemp, Warning, TEXT("enemy name: %s"), *Enemy->GetName());
}
}*/
Destroy();

View File

@ -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"
@ -21,46 +25,180 @@ void ABaseWeaponClass::BeginPlay()
// Attempt to find the player character
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);
player = Cast<AEndlessVendettaCharacter>(PlayerController->GetCharacter());
if (PlayerController)
playerInWorld = Cast<AEndlessVendettaCharacter>(PlayerController->GetCharacter());
endlessVendettaChar = Cast<AEndlessVendettaCharacter>(playerInWorld);
for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(), FName("GunStart")))
{
if (player)
GunStartArrow = Cast<UArrowComponent>(actorComp);
break;
}
if (!playerControllerRef)
{
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."));
playerControllerRef = UGameplayStatics::GetPlayerController(GetWorld(), 0);
}
originalMagnitude = recoilMagnitude;
originalMaxAngleLeft = recoilMaxAngleLeft;
originalMaxAngleRight = recoilMaxAngleRight;
originalMinMultiplier = recoilMinMultiplier;
currentAmmoCount = MagazineSize;
UE_LOG(LogTemp, Display, TEXT("crnnt ammo: %d"), MagazineSize);
}
// Called every frame
void ABaseWeaponClass::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (playerInWorld)
{
ApplyRecoil(DeltaTime);
}
}
void ABaseWeaponClass::TapFire()
// 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;
playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime));
playerInWorld->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);
}
void ABaseWeaponClass::CancelFire()
{
GetWorldTimerManager().ClearTimer(timerHandle);
}
void ABaseWeaponClass::Fire()
{
if(currentAmmoCount > 0)
{
//do damage fallof based off distance
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 + (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, true);
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f);
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
currentAmmoCount -= 1;
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), currentAmmoCount);
GenerateRecoilVector();
ClickDetectionTimer();
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"));
}
else if(currentAmmoCount <= 0)
{
UE_LOG(LogTemp, Display, TEXT("No ammo, Ammo count: %d"), currentAmmoCount);
}
}
void ABaseWeaponClass::WeaponScopedFire()
{
if (endlessVendettaChar->bIsScoped)
{
recoilMagnitude -= 0.2f;
recoilMaxAngleLeft /= 2.f;
recoilMaxAngleRight /= 2.f;
recoilMinMultiplier -= 0.2f;
}
else
{
recoilMagnitude = originalMagnitude;
recoilMaxAngleLeft = originalMaxAngleLeft;
recoilMaxAngleRight = originalMaxAngleRight;
recoilMinMultiplier = originalMinMultiplier;
}
}
void ABaseWeaponClass::WeaponReload()
{
if(MagazineSize > currentAmmoCount)
{
UE_LOG(LogTemp, Display, TEXT("Weapon Reloading: mag size: %d"), MagazineSize);
currentAmmoCount = MagazineSize;
}
}

View File

@ -4,6 +4,8 @@
#include "CoreMinimal.h"
#include "WeaponItemClass.h"
#include "Components/ArrowComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "BaseWeaponClass.generated.h"
class AEndlessVendettaCharacter;
@ -22,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;
@ -42,17 +61,70 @@ public:
UTexture2D* WeaponImage;
UFUNCTION(BlueprintCallable, Category = "Weapons")
void TapFire();
virtual void Fire();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void ClickDetectionTimer();
void CancelFire();
UPROPERTY(VisibleAnywhere)
ACharacter* player;
ACharacter* playerInWorld;
AEndlessVendettaCharacter* endlessVendettaChar;
APlayerController* playerControllerRef;
FTimerHandle timerHandle;
//Add HoldFire functionality after pistol is complete for holding fire for pistol and make it start spraying innacuratly.
bool bFirstBulletShot = false;
// UFUNCTION(BlueprintCallable, Category = "Weapons")
// void HoldFire();
UPROPERTY(EditAnywhere)
TSubclassOf<UCameraShakeBase> 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);
UFUNCTION(BlueprintCallable, Category = "Weapons")
void WeaponScopedFire();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void WeaponReload();
private:
UArrowComponent* GunStartArrow;
UPROPERTY(EditAnywhere)
float BulletDistance;
float originalMagnitude;
float originalMaxAngleLeft;
float originalMaxAngleRight;
float originalMinMultiplier;
int currentAmmoCount;
};

View File

@ -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"));
}

View File

@ -22,4 +22,6 @@ protected:
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
virtual void Fire() override;
};

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "WeaponCameraShake.h"

View File

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