Merge remote-tracking branch 'origin/WeaponPickupSystem' into TutorialBounty

# Conflicts:
#	EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WBP_AmmoCount.uasset
This commit is contained in:
Rafal Swierczek 2023-10-17 22:45:52 +01:00
commit ab76177b16
17 changed files with 61 additions and 32 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6fcb43487faf257a1d6bd07ee96a648ca53488eaad3edd5a3b3ab8c07e3ae536
size 17747
oid sha256:dc50c3543a327059c08017f0b8a04537afb43e749128c4db5092497cb3d5953d
size 17913

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a91f4e1494cb343bf7ab5c80888a3a1d89fe21198ef5280482273eb8d9ba7530
size 17924
oid sha256:6d811cdb5d40293dd0004da6d84068a1e2c57176b9eb78c7f962fd45f02a5cd8
size 18088

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:24ef74b38ec69cbe179147bd5ac8a53362dfe3169b4d83ebe0ef0d1848f743cd
size 17243
oid sha256:0eeb36176a9c00e72b77045d94a2c5db73716dbc3b8cd30f17ed1e10bd663da4
size 17430

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:279be05fb4b4a84ff360ec933a43ef2791643c8840c724691ea6976ae9d4856a
size 20162
oid sha256:0072bcd3eb1509d0d10470185cd0a5a0e62c5ae8eea6a6546a2272012a5686d0
size 20297

Binary file not shown.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:afbf0b8a0b4a42008dc0a9110d1dacfcda4b62d391568de0f9cf720191bbac84
size 1645261
oid sha256:c7e3957f747f64afda55ea8781d6d17211c1f615d99039769cabb1eb2d75275f
size 1645653

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c65f7761aed5143a2449a2a4911dcc920a848f6cb4762b1a066f26318be8f18
size 2960090
oid sha256:563f8c228e8a4ffd5c7415f83a98407ed9c205c3d136b8de6cd082f295a95979
size 2960482

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:797990c3f21eb6c8703ad1d9aefe0077019aa2fac3499cb2054aa77870cba8ef
size 352560
oid sha256:30ebba255de23d1b6eaff6d9ff9abd1c9cbbc4e33e18ea4c85e61baeb7e25f2c
size 352952

View File

@ -66,6 +66,11 @@ void AEndlessVendettaCharacter::BeginPlay()
}
}
void AEndlessVendettaCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
//////////////////////////////////////////////////////////////////////////// Input
void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
@ -251,11 +256,11 @@ void AEndlessVendettaCharacter::EquipSecondary()
//Calls the fire function in the baseWeaponClass
void AEndlessVendettaCharacter::FireCaller()
{
if (IsValid(PrimaryWeapon))
if (IsValid(PrimaryWeapon) && !bIsReloading)
{
PrimaryWeapon->Fire();
}
if (IsValid(SecondaryWeapon))
if (IsValid(SecondaryWeapon) && !bIsReloading)
{
SecondaryWeapon->Fire();
}
@ -325,11 +330,13 @@ void AEndlessVendettaCharacter::GunReload()
{
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->WeaponReload();
PrimaryWeapon->ReloadTimer();
bIsReloading = true;
}
if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->WeaponReload();
SecondaryWeapon->ReloadTimer();
bIsReloading = true;
}
}

View File

@ -83,6 +83,7 @@ public:
protected:
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditDefaultsOnly, Category = "Gadget")
TSubclassOf<AGadgetManager> GadgetManagerClass;
@ -90,6 +91,7 @@ protected:
public:
int Money = 2000;
bool bIsReloading = false;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))

View File

@ -54,6 +54,7 @@ void ABaseWeaponClass::BeginPlay()
UE_LOG(LogTemp, Display, TEXT("crnnt ammo: %d"), MagazineSize);
}
// Called every frame
void ABaseWeaponClass::Tick(float DeltaTime)
{
@ -63,7 +64,6 @@ 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;
@ -213,12 +213,20 @@ void ABaseWeaponClass::WeaponScopedFire()
}
}
void ABaseWeaponClass::ReloadTimer()
{
GetWorldTimerManager().SetTimer(reloadTimerHandle, this, &ABaseWeaponClass::WeaponReload, TimeToReload, false);
ShowReloadingWidget();
}
void ABaseWeaponClass::WeaponReload()
{
if(MagazineSize > currentAmmoCount)
if(MagazineSize >= currentAmmoCount)
{
UE_LOG(LogTemp, Display, TEXT("Weapon Reloading: mag size: %d"), MagazineSize);
currentAmmoCount = MagazineSize;
endlessVendettaChar->bIsReloading = false;
HideReloadingWidget();
}
}

View File

@ -41,10 +41,18 @@ protected:
float recoilResultPitch = 0;
float recoilResultYaw = 0;
UFUNCTION(BlueprintImplementableEvent)
void ShowReloadingWidget();
UFUNCTION(BlueprintImplementableEvent)
void HideReloadingWidget();
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void ReloadTimer();
UPROPERTY(EditAnywhere)
FName WeaponName;
@ -57,6 +65,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int MagazineSize;
UPROPERTY(EditAnywhere)
float TimeToReload = 3.f;
//how many bullets until the recoil stops going up
UPROPERTY(EditAnywhere)
int howMnyShotsTillRclStop;
@ -95,6 +106,7 @@ public:
APlayerController* playerControllerRef;
FTimerHandle timerHandle;
FTimerHandle reloadTimerHandle;
bool bFirstBulletShot = false;