health var updates correctly on client when hit by projectile

This commit is contained in:
2026-01-01 19:35:48 -05:00
parent dd3648f5b9
commit 3b9a02b3b1
4 changed files with 63 additions and 8 deletions

View File

@@ -31,12 +31,24 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
UDDIHealth* HealthComponent;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Projectile")
TSubclassOf<AActor> ProjectileClass;
/*Functions*/
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION()
void TakeDamage(int Damage);
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
void Server_SpawnProjectile();
UFUNCTION(Client, Reliable, WithValidation, BlueprintCallable)
void Client_CharacterHit();
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
void Server_CharacterHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
/*C++ only declarations*/
private: