Merge branch 'BackupBuild' into dev

# Conflicts:
#	EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
#	EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
This commit is contained in:
Rafal Swierczek 2023-10-16 13:33:10 +01:00
commit 8f951c3927
23 changed files with 134 additions and 49 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -26,6 +26,7 @@ r.Mobile.EnableNoPrecomputedLightingCSMShader=1
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=true
r.Shadow.Virtual.Enable=1
r.DefaultFeature.AutoExposure=False
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
@ -88,3 +89,8 @@ ManualIPAddress=
[CoreRedirects]
+PropertyRedirects=(OldName="/Script/EndlessVendetta.BaseWeaponClass.player",NewName="/Script/EndlessVendetta.BaseWeaponClass.playerInWorld")
[/Script/NavigationSystem.RecastNavMesh]
AgentMaxStepHeight=73.434059
AgentMaxSlope=64.648003

Binary file not shown.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d593d68d5b9a9fc58b1b7ecc44936b84e361aaa1762ab04c5924e36bfd45bee9
size 61494

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ffb6c31ffcde26ae8a0f677a27ced553a7f10e9a7a41786f4c7a319f02205bc
size 411380

View File

@ -24,6 +24,9 @@ void ABaseWeaponClass::BeginPlay()
{
Super::BeginPlay();
collisionParams.AddIgnoredActor(playerInWorld);
collisionParams.AddIgnoredActor(this);
// Attempt to find the player character
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);
playerInWorld = Cast<AEndlessVendettaCharacter>(PlayerController->GetCharacter());
@ -60,6 +63,13 @@ void ABaseWeaponClass::Tick(float DeltaTime)
{
ApplyRecoil(DeltaTime);
}
UE_LOG(LogTemp, Display, TEXT("currnt pitch: %f"), currentPitch);
if (currentPitch < 0 && bStopShooting)
{
float increment = currentPitch * DeltaTime * 8;
currentPitch -= increment;
playerInWorld->AddControllerPitchInput(-increment);
}
}
@ -73,6 +83,10 @@ void ABaseWeaponClass::GenerateRecoilVector()
recoilResultYaw = FMath::Sin(FMath::DegreesToRadians(angle));
recoilResultPitch = FMath::Cos(FMath::DegreesToRadians(angle));
if (bulletCountShoot >= howMnyShotsTillRclStop)
{
recoilResultPitch = 0;
}
//scaling direction to magnitude
recoilResultPitch *= -tempMag;
recoilResultYaw *= tempMag;
@ -87,11 +101,14 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime)
{
float amplitude = RecoilCurve->GetFloatValue(recoilTime); //get current value of curve in time
recoilTime += DeltaTime;
if (bulletCountShoot <= 3) playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime));
traceEnd = traceStart + (UKismetMathLibrary::GetForwardVector(playerInWorld->GetControlRotation() * GetRecoilPitch(amplitude, recoilTime)));
//UE_LOG(LogTemp, Warning, TEXT("Controller pitch: Pitch: %f Yaw: %f, Roll: %f"), playerInWorld->GetControlRotation().Pitch, playerInWorld->GetControlRotation().Yaw, playerInWorld->GetControlRotation().Roll);
if (bulletCountShoot <= 3)
{
playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime));
currentPitch += GetRecoilPitch(amplitude,recoilTime);
}
playerInWorld->AddControllerPitchInput(FMath::RandRange(-5 * DeltaTime, 5* DeltaTime));
GunStartArrow->AddRelativeRotation(FRotator(-GetRecoilPitch(amplitude, recoilTime), 0, 0));
playerInWorld->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime));
//UE_LOG(LogTemp, Warning, TEXT("recoilTime: %f"), recoilTime);
UpdateSamples(amplitude, recoilTime);
}
}
@ -139,8 +156,13 @@ void ABaseWeaponClass::ClickDetectionTimer()
void ABaseWeaponClass::CancelFire()
{
GetWorldTimerManager().ClearTimer(timerHandle);
if (bulletCountShoot <= 0) return;
UE_LOG(LogTemp, Display, TEXT("FireCancelled"));
bulletCountShoot = 0;
GunStartArrow->SetRelativeRotation(FRotator(0));
//playerInWorld->GetController()->SetControlRotation(FRotator(0, playerInWorld->GetActorRotation().Yaw, playerInWorld->GetActorRotation().Roll));
bStopShooting = true;
nullSamples();
}
void ABaseWeaponClass::Fire()
@ -150,26 +172,17 @@ void ABaseWeaponClass::Fire()
//do damage fallof based off distance
traceStart = GunStartArrow->GetComponentLocation();
traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance);
FCollisionQueryParams collisionParams;
collisionParams.AddIgnoredActor(playerInWorld);
collisionParams.AddIgnoredActor(this);
/*RecoilVerticalLimit(outHit);*/
if (GetWorldTimerManager().IsTimerActive(timerHandle))
{
return;
}
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);
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Black , false, 0.2f, 0U, 0.2f);
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
currentAmmoCount -= 1;
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), currentAmmoCount);
GenerateRecoilVector();
ClickDetectionTimer();
bulletCountShoot += 1;
bStopShooting = false;
if (outHit.bBlockingHit)
{
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %s"), *outHit.GetActor()->GetName());
if (!Cast<AAICharacter>(outHit.GetActor())) return;
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
}
@ -185,10 +198,10 @@ void ABaseWeaponClass::WeaponScopedFire()
{
if (endlessVendettaChar->bIsScoped)
{
recoilMagnitude -= 0.2f;
recoilMaxAngleLeft /= 2.f;
recoilMaxAngleRight /= 2.f;
recoilMinMultiplier -= 0.2f;
recoilMagnitude = scopedRecoilMag;
recoilMaxAngleLeft = scopedMaxAngleLeft;
recoilMaxAngleRight = scopedMaxAngleRight;
recoilMinMultiplier = scopedMinMultiplier;
}
else

View File

@ -24,10 +24,10 @@ protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void GenerateRecoilVector();
void ApplyRecoil(float DeltaTime);
void GenerateRecoilVector();
void nullSamples();
//recoil previous curve
@ -54,19 +54,38 @@ public:
UPROPERTY(EditAnywhere)
float FireRate;
UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int MagazineSize;
//how many bullets until the recoil stops going up
UPROPERTY(EditAnywhere)
int howMnyShotsTillRclStop;
UPROPERTY(BlueprintReadWrite)
int currentAmmoCount;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* WeaponImage;
UPROPERTY(EditAnywhere, Category = "ScopedFire")
float scopedRecoilMag;
UPROPERTY(EditAnywhere, Category = "ScopedFire")
float scopedMaxAngleLeft;
UPROPERTY(EditAnywhere, Category = "ScopedFire")
float scopedMaxAngleRight;
UPROPERTY(EditAnywhere, Category = "ScopedFire")
float scopedMinMultiplier;
UFUNCTION(BlueprintCallable, Category = "Weapons")
virtual void Fire();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void ClickDetectionTimer();
virtual void ClickDetectionTimer();
void CancelFire();
virtual void CancelFire();
UPROPERTY(VisibleAnywhere)
ACharacter* playerInWorld;
@ -116,6 +135,8 @@ public:
FHitResult outHit;
FVector traceStart;
FVector traceEnd;
FVector newTraceEnd;
FCollisionQueryParams collisionParams;
//UFUNCTION(BlueprintCallable, Category = "Weapons")
//void RecoilVerticalLimit(FHitResult Outhit);
@ -123,9 +144,12 @@ public:
UPROPERTY(EditAnywhere)
int bulletCountShoot; //Gets how many bullets shot per
private:
protected:
UArrowComponent* GunStartArrow;
bool bStopShooting = false;
private:
UPROPERTY(EditAnywhere)
float BulletDistance;
@ -135,6 +159,6 @@ private:
float originalMaxAngleRight;
float originalMinMultiplier;
int currentAmmoCount;
float currentPitch;
};

View File

@ -30,3 +30,19 @@ void APistolClass::Fire()
UE_LOG(LogTemp, Display, TEXT("Testing overrides: Pistol has been fired"));
}
void APistolClass::ClickDetectionTimer()
{
Super::ClickDetectionTimer();
}
void APistolClass::CancelFire()
{
if (bulletCountShoot <= 0) return;
UE_LOG(LogTemp, Display, TEXT("FireCancelled"));
bulletCountShoot = 0;
GunStartArrow->SetRelativeRotation(FRotator(0));
//playerInWorld->GetController()->SetControlRotation(FRotator(0, playerInWorld->GetActorRotation().Yaw, playerInWorld->GetActorRotation().Roll));
bStopShooting = true;
nullSamples();
}

View File

@ -24,4 +24,6 @@ public:
virtual void Tick(float DeltaTime) override;
virtual void Fire() override;
virtual void ClickDetectionTimer() override;
virtual void CancelFire() override;
};