60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Blaster/Character/BlasterCharacter.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "LagCompensationComponent.generated.h"
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FBoxInformation
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
UPROPERTY()
|
|
FVector Location;
|
|
|
|
UPROPERTY()
|
|
FRotator Rotation;
|
|
|
|
UPROPERTY()
|
|
FVector BoxExtend;
|
|
};
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FFramePackage
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
UPROPERTY()
|
|
float Time;
|
|
|
|
TMap<FName, FBoxInformation> HitBoxInfo;
|
|
};
|
|
|
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
class BLASTER_API ULagCompensationComponent : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ULagCompensationComponent();
|
|
friend ABlasterCharacter;
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
void ShowFramePackage(const FFramePackage& Package, const FColor Color);
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
void SaveFramePackage(FFramePackage& Package);
|
|
|
|
private:
|
|
|
|
UPROPERTY()
|
|
ABlasterCharacter* Character;
|
|
|
|
UPROPERTY()
|
|
ABlasterPlayerController* Controller;
|
|
|
|
};
|