blaster/Source/Blaster/Components/CombatComponent.h

40 lines
984 B
C
Raw Normal View History

2022-04-30 11:09:28 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "CombatComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BLASTER_API UCombatComponent : public UActorComponent
{
GENERATED_BODY()
public:
UCombatComponent();
friend class ABlasterCharacter;
2022-04-30 14:48:34 +00:00
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
2022-04-30 11:09:28 +00:00
void EquipWeapon(class AWeapon* WeaponToEquip);
protected:
virtual void BeginPlay() override;
2022-04-30 15:38:03 +00:00
void SetAiming(bool bIsAiming);
UFUNCTION(Server, Reliable)
void ServerSetAiming(bool bIsAiming);
2022-04-30 11:09:28 +00:00
private:
class ABlasterCharacter* Character;
2022-04-30 14:48:34 +00:00
UPROPERTY(Replicated)
2022-04-30 11:09:28 +00:00
class AWeapon* EquippedWeapon;
2022-04-30 15:38:03 +00:00
UPROPERTY(Replicated)
bool bAiming;
2022-04-30 11:09:28 +00:00
};