Added ExtendedMag code to give more ammo to the weapon
This commit is contained in:
parent
2542404a4f
commit
826cadbbcb
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset
(Stored with Git LFS)
Binary file not shown.
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "ExtendedMagAttachmentClass.h"
|
#include "ExtendedMagAttachmentClass.h"
|
||||||
|
|
||||||
|
#include "EndlessVendetta/WeaponSystem/BaseWeaponClass.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UExtendedMagAttachmentClass::UExtendedMagAttachmentClass()
|
UExtendedMagAttachmentClass::UExtendedMagAttachmentClass()
|
||||||
@ -19,9 +21,11 @@ UExtendedMagAttachmentClass::UExtendedMagAttachmentClass()
|
|||||||
void UExtendedMagAttachmentClass::BeginPlay()
|
void UExtendedMagAttachmentClass::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
BaseWeaponClass = Cast<ABaseWeaponClass>(this->GetAttachParentActor());
|
||||||
// ...
|
if (BaseWeaponClass)
|
||||||
|
{
|
||||||
|
IncreaseAmmoCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -31,3 +35,11 @@ void UExtendedMagAttachmentClass::TickComponent(float DeltaTime, ELevelTick Tick
|
|||||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UExtendedMagAttachmentClass::IncreaseAmmoCount()
|
||||||
|
{
|
||||||
|
if (!IsValid(BaseWeaponClass)) return;
|
||||||
|
UE_LOG(LogTemp, Warning, TEXT("AmmoCountIncrease activated"));
|
||||||
|
BaseWeaponClass->MagazineSize *= 2;
|
||||||
|
BaseWeaponClass->currentAmmoCount = BaseWeaponClass->MagazineSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -23,4 +23,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
class ABaseWeaponClass* BaseWeaponClass;
|
||||||
|
|
||||||
|
void IncreaseAmmoCount();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user