Added OnRep to health componenet
This commit is contained in:
@@ -102,3 +102,14 @@ bool ADDICharacter::Server_CharacterHit_Validate(UPrimitiveComponent* HitCompone
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Components/DDIHealth.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "DDICharacter.generated.h"
|
||||
|
||||
|
||||
@@ -28,7 +29,7 @@ public:
|
||||
/*Properties*/
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Camera")
|
||||
UCameraComponent* CameraComponent;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health", ReplicatedUsing=OnRep_Health)
|
||||
UDDIHealth* HealthComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Projectile")
|
||||
@@ -50,6 +51,9 @@ public:
|
||||
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
|
||||
void Server_CharacterHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
|
||||
|
||||
UFUNCTION()
|
||||
void OnRep_Health();
|
||||
|
||||
/*C++ only declarations*/
|
||||
private:
|
||||
/*Properties*/
|
||||
|
||||
Reference in New Issue
Block a user