https://differentdirection.youtrack.cloud/issue/OC-3/Replication-Projectiles complete #3

Merged
Keeper317 merged 26 commits from projectilebase into main 2026-01-03 06:14:31 +00:00
2 changed files with 16 additions and 1 deletions
Showing only changes of commit 7b9a33abfe - Show all commits

View File

@@ -101,4 +101,15 @@ void ADDICharacter::Server_CharacterHit_Implementation(UPrimitiveComponent* HitC
bool ADDICharacter::Server_CharacterHit_Validate(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) bool ADDICharacter::Server_CharacterHit_Validate(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{ {
return true; return true;
}
void ADDICharacter::OnRep_Health()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "Health Replicated");
}
void ADDICharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ADDICharacter, HealthComponent);
} }

View File

@@ -6,6 +6,7 @@
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "Components/DDIHealth.h" #include "Components/DDIHealth.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "Net/UnrealNetwork.h"
#include "DDICharacter.generated.h" #include "DDICharacter.generated.h"
@@ -28,7 +29,7 @@ public:
/*Properties*/ /*Properties*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Camera") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Camera")
UCameraComponent* CameraComponent; UCameraComponent* CameraComponent;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health", ReplicatedUsing=OnRep_Health)
UDDIHealth* HealthComponent; UDDIHealth* HealthComponent;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Projectile") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Projectile")
@@ -50,6 +51,9 @@ public:
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable) UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
void Server_CharacterHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit); void Server_CharacterHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION()
void OnRep_Health();
/*C++ only declarations*/ /*C++ only declarations*/
private: private:
/*Properties*/ /*Properties*/