183 - Frame Package

This commit is contained in:
Kingsmedia 2022-05-27 11:06:39 +02:00
parent 739f9f325b
commit a52dc24cdf
3 changed files with 50 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include "Blaster/Blaster.h"
#include "Blaster/Components/BuffComponent.h"
#include "Blaster/Components/CombatComponent.h"
#include "Blaster/Components/LagCompensationComponent.h"
#include "Blaster/GameMode/BlasterGameMode.h"
#include "Blaster/PlayerController/BlasterPlayerController.h"
#include "Blaster/PlayerState/BlasterPlayerState.h"
@ -45,6 +46,8 @@ ABlasterCharacter::ABlasterCharacter()
Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
Combat->SetIsReplicated(true);
LagCompensation = CreateDefaultSubobject<ULagCompensationComponent>(TEXT("LagCompensation"));
Buff = CreateDefaultSubobject<UBuffComponent>(TEXT("BuffComponent"));
Buff->SetIsReplicated(true);
@ -336,6 +339,14 @@ void ABlasterCharacter::PostInitializeComponents()
Buff->SetInitialSpeeds(GetCharacterMovement()->MaxWalkSpeed, GetCharacterMovement()->MaxWalkSpeedCrouched);
Buff->SetInitialJumpVelocity(GetCharacterMovement()->JumpZVelocity);
}
if (LagCompensation)
{
LagCompensation->Character = this;
if (Controller)
{
LagCompensation->Controller = Cast<ABlasterPlayerController>(Controller);
}
}
}
void ABlasterCharacter::PlayFireMontage(bool bAiming)

View File

@ -150,11 +150,16 @@ private:
UFUNCTION()
void OnRep_OverlappingWeapon(AWeapon* LastWeapon);
// Blaster Components
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UCombatComponent* Combat;
UPROPERTY(VisibleAnywhere)
class UBuffComponent* Buff;
UPROPERTY(VisibleAnywhere)
class ULagCompensationComponent* LagCompensation;
UFUNCTION(Server, Reliable)
void ServerEquipButtonPressed();

View File

@ -3,9 +3,35 @@
#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
@ -14,12 +40,19 @@ class BLASTER_API ULagCompensationComponent : public UActorComponent
public:
ULagCompensationComponent();
friend ABlasterCharacter;
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
protected:
virtual void BeginPlay() override;
public:
private:
UPROPERTY()
ABlasterCharacter* Character;
UPROPERTY()
ABlasterPlayerController* Controller;
};