155 - Buff Component
This commit is contained in:
parent
9e357cb57b
commit
bc681ab8a6
|
@ -4,6 +4,7 @@
|
||||||
#include "BlasterCharacter.h"
|
#include "BlasterCharacter.h"
|
||||||
|
|
||||||
#include "Blaster/Blaster.h"
|
#include "Blaster/Blaster.h"
|
||||||
|
#include "Blaster/Components/BuffComponent.h"
|
||||||
#include "Blaster/Components/CombatComponent.h"
|
#include "Blaster/Components/CombatComponent.h"
|
||||||
#include "Blaster/GameMode/BlasterGameMode.h"
|
#include "Blaster/GameMode/BlasterGameMode.h"
|
||||||
#include "Blaster/PlayerController/BlasterPlayerController.h"
|
#include "Blaster/PlayerController/BlasterPlayerController.h"
|
||||||
|
@ -43,6 +44,9 @@ ABlasterCharacter::ABlasterCharacter()
|
||||||
Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
||||||
Combat->SetIsReplicated(true);
|
Combat->SetIsReplicated(true);
|
||||||
|
|
||||||
|
Buff = CreateDefaultSubobject<UBuffComponent>(TEXT("BuffComponent"));
|
||||||
|
Buff->SetIsReplicated(true);
|
||||||
|
|
||||||
GetCharacterMovement()->NavAgentProps.bCanCrouch = true;
|
GetCharacterMovement()->NavAgentProps.bCanCrouch = true;
|
||||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore);
|
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore);
|
||||||
GetMesh()->SetCollisionObjectType(ECC_SkeletalMesh);
|
GetMesh()->SetCollisionObjectType(ECC_SkeletalMesh);
|
||||||
|
@ -249,6 +253,10 @@ void ABlasterCharacter::PostInitializeComponents()
|
||||||
{
|
{
|
||||||
Combat->Character = this;
|
Combat->Character = this;
|
||||||
}
|
}
|
||||||
|
if (Buff)
|
||||||
|
{
|
||||||
|
Buff->Character = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::PlayFireMontage(bool bAiming)
|
void ABlasterCharacter::PlayFireMontage(bool bAiming)
|
||||||
|
|
|
@ -92,6 +92,9 @@ private:
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
||||||
class UCombatComponent* Combat;
|
class UCombatComponent* Combat;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere)
|
||||||
|
class UBuffComponent* Buff;
|
||||||
|
|
||||||
UFUNCTION(Server, Reliable)
|
UFUNCTION(Server, Reliable)
|
||||||
void ServerEquipButtonPressed();
|
void ServerEquipButtonPressed();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "BuffComponent.h"
|
||||||
|
|
||||||
|
UBuffComponent::UBuffComponent()
|
||||||
|
{
|
||||||
|
PrimaryComponentTick.bCanEverTick = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UBuffComponent::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UBuffComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||||
|
{
|
||||||
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Components/ActorComponent.h"
|
||||||
|
#include "BuffComponent.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||||
|
class BLASTER_API UBuffComponent : public UActorComponent
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UBuffComponent();
|
||||||
|
friend class ABlasterCharacter;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY()
|
||||||
|
class ABlasterCharacter* Character;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
Loading…
Reference in New Issue