Working on netowrked projectiles

This commit is contained in:
2025-12-08 21:35:24 -05:00
parent 494d76833f
commit ecd15c271f
10 changed files with 86 additions and 9 deletions

View File

@@ -36,13 +36,13 @@ protected:
ClassNames ClassName;
/*Functions*/
UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, Category = "Health")
void TakeDamage(int DamageValue);
public:
/*Properties*/
/*Functions*/
UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, Category = "Health")
void TakeDamage(int DamageValue);
/*C++ only declarations*/
private:

View File

@@ -9,7 +9,7 @@ struct FHealthSegment : public FTableRowBase
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health Segments")
ClassNames Class;
ClassNames Class = ClassNames::Basic;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health Segments")
TArray<int> SegmentList;

View File

@@ -50,11 +50,10 @@ void ADDICharacter::Tick(float DeltaTime)
void ADDICharacter::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if (OtherActor->Owner == this)
return;
AProjectileBase* Projectile = Cast<AProjectileBase>(OtherActor);
if (HealthComponent && Projectile)
HealthComponent->TakeDamage(10);
}
void ADDICharacter::TakeDamage(int Damage)
{
HealthComponent->TakeDamage(Damage);
}

View File

@@ -35,6 +35,8 @@ public:
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION()
void TakeDamage(int Damage);
/*C++ only declarations*/
private: