Consider this:
I have multiple items that have health attributes and can also attack:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Health")
float HealthPercentageDecimal();
UFUNCTION(BlueprintImplementableEvent, Category = "Health")
void OnHPZero();
UFUNCTION(BlueprintImplementableEvent, Category = "Health")
void OnTakeHitFromRaycast(const FHitResult Hit);
UFUNCTION(BlueprintImplementableEvent, Category = "Health")
void OnTakeHit();
virtual void TakeHitFromRaycast(const int32 IncomingDamage, const FHitResult Hit);
virtual void TakeHit(const int32 IncomingDamage);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health")
int32 TotalHitPoints{100};
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attack")
int32 AttackDamage{10};
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health")
int32 CurrentHitPoints{100};
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attack")
float AttackRange{200};
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attack")
float AttackCooldown{ 1.0 };
I have a APawn that needs ALL of these functions and properties.
I have an ACharacter that needs ALL of these functions and properties.
The pawn can NEVER be a Character, so a base class wont work.
A UInterface will only let me create BlueprintImplementableEvents.
What I would LIKE to do (as in other languages), is simply extend APawn with this functionality. But apparently C++ does not support this.
Is there a way to create a custom APawn and have ACharacter inherit from my custom pawn instead?