// Fill out your copyright notice in the Description page of Project Settings. #include "DDICharacter.h" #include "Components/CapsuleComponent.h" #include "GameFramework/SpringArmComponent.h" #include "OpenConflict/Weapons/Projectiles/ProjectileBase.h" // Sets default values ADDICharacter::ADDICharacter() { // Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; bReplicates = true; // bReplicateMovement = true; CameraComponent = CreateDefaultSubobject(TEXT("CameraComponent")); CameraComponent->SetupAttachment(GetMesh(), "headSocket"); CameraComponent->SetRelativeLocation(FVector(0.0f, 0.0f, 50.0f)); CameraComponent->bUsePawnControlRotation = true; HealthComponent = CreateDefaultSubobject(TEXT("HealthComponent")); GetCapsuleComponent()->SetCollisionProfileName(TEXT("BlockAllDynamic")); GetCapsuleComponent()->SetGenerateOverlapEvents(true); GetCapsuleComponent()->SetNotifyRigidBodyCollision(true); } // Called when the game starts or when spawned void ADDICharacter::BeginPlay() { Super::BeginPlay(); if (GetCapsuleComponent()) { GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &ADDICharacter::OnHit); } } // Called every frame void ADDICharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); } void ADDICharacter::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { } void ADDICharacter::TakeDamage(int Damage) { HealthComponent->TakeDamage(Damage); }