Hey,
So basically my delegate isn’t working anymore I had to reinstall my pc and used a back up to restore BattleTank and now it’s not working it mightb be cause it asked me to download 4.21.2 instead of 4.21 I had last time in Tank_BP I’m not able to Bind event to OnTankDeath infact it doesn’t show it at all
here’s my code
Tank.h:
// © Neonzz game studios
#pragma once
#include "GameFramework/Pawn.h"
#include "Tank.generated.h"
UENUM()
enum class EHealthState : uint8
{
Full,
Half,
Low,
OutOfLife
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FTankDelegate);
UCLASS()
class BATTLETANK_API ATank : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
virtual float TakeDamage(float DamageAmmount, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override;
UFUNCTION(BlueprintPure, Category = "Health")
float GetHealthPercent() const;
UFUNCTION(BlueprintCallable, Category = "Health")
EHealthState GetHealthState() const;
FTankDelegate OnTankDeath;
protected:
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
UPROPERTY(BlueprintReadOnly, Category = "State")
EHealthState HealthState = EHealthState::Full;
private:
ATank();
UPROPERTY(EditDefaultsOnly, Category = "Setup")
int32 StartingHealth = 100;
UPROPERTY(VisibleAnywhere, Category = "Health")
int32 CurrentHealth;
};