Make FireWeaponAction a BlueprintNativeEvent

This commit is contained in:
baz 2024-07-22 00:51:27 +01:00
parent 26edffa233
commit 7102040635
4 changed files with 10 additions and 9 deletions

View File

@ -25,8 +25,9 @@ void AWeapon::BeginPlay()
}
}
void AWeapon::FireWeaponAction()
void AWeapon::FireWeaponAction_Implementation()
{
// Do stuff
}
void AWeapon::UpgradeWeapon(int newLevel)

View File

@ -12,10 +12,10 @@ class VAMPIRES_API AWeapon : public AActor
GENERATED_BODY()
public:
UPROPERTY()
UPROPERTY(BlueprintReadWrite)
float WeaponCooldown = 1.0f;
UPROPERTY()
UPROPERTY(BlueprintReadWrite)
float Damage;
private:
@ -30,8 +30,10 @@ protected:
virtual void BeginPlay() override;
public:
UFUNCTION(BlueprintCallable)
virtual void FireWeaponAction();
UFUNCTION(BlueprintNativeEvent)
void FireWeaponAction();
virtual void FireWeaponAction_Implementation();
UFUNCTION()
virtual void UpgradeWeapon(int newLevel);

View File

@ -18,7 +18,7 @@ void AGarlicWeapon::BeginPlay()
SphereComponent->OnComponentEndOverlap.AddDynamic(this, &AGarlicWeapon::OnEndOverlap);
}
void AGarlicWeapon::FireWeaponAction()
void AGarlicWeapon::FireWeaponAction_Implementation()
{
TArray<AEnemyCharacter*> OverlappedEnemiesCache = OverlappedEnemies;
@ -54,8 +54,6 @@ void AGarlicWeapon::FireWeaponAction()
i -= 1;
}
}
Super::FireWeaponAction();
}
void AGarlicWeapon::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,

View File

@ -27,7 +27,7 @@ protected:
virtual void BeginPlay() override;
public:
virtual void FireWeaponAction() override;
virtual void FireWeaponAction_Implementation() override;
protected:
UFUNCTION()