Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
KnockbackComponent.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CK_UE.h"
6#include "Components/ActorComponent.h"
8#include "KnockbackComponent.generated.h"
9
10class ACharacter;
11class UCharacterMovementComponent;
12
13
14UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
15class CK_UE_API UKnockbackComponent : public UActorComponent
16{
17 GENERATED_BODY()
18
19public:
20 UKnockbackComponent();
21
22 void ApplyKnockback(const FVector& Direction, const FKnockbackData& KnockbackData);
23
24protected:
25 virtual void BeginPlay() override;
26 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
27
28private:
29 float GetKnockbackApplyTimeRatio(bool bIgnoreKnockbackResistance) const;
30 void ApplyKnockbackVelocity() const;
31 void FinishKnockback();
32
33private:
34 UPROPERTY(Transient)
35 TObjectPtr<ACharacter> OwnerCharacter = nullptr;
36
37 UPROPERTY(Transient)
38 TObjectPtr<UCharacterMovementComponent> MovementComponent = nullptr;
39
40private:
41 FVector KnockbackDirection = FVector::ZeroVector;
42 float KnockbackStrength = 0.0f;
43 float RemainingTime = 0.0f;
44};
Definition KnockbackData.h:11