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
|
|
|
|
2022-05-02 13:40:33 +00:00
|
|
|
UFUNCTION()
|
|
|
|
void OnRep_EquippedWeapon();
|
|
|
|
|
2022-04-30 11:09:28 +00:00
|
|
|
private:
|
|
|
|
class ABlasterCharacter* Character;
|
2022-04-30 14:48:34 +00:00
|
|
|
|
2022-05-02 13:40:33 +00:00
|
|
|
UPROPERTY(ReplicatedUsing=OnRep_EquippedWeapon)
|
2022-04-30 11:09:28 +00:00
|
|
|
class AWeapon* EquippedWeapon;
|
2022-04-30 15:38:03 +00:00
|
|
|
|
|
|
|
UPROPERTY(Replicated)
|
|
|
|
bool bAiming;
|
2022-05-03 17:50:47 +00:00
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
float BaseWalkSpeed;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
float AimWalkSpeed;
|
2022-04-30 11:09:28 +00:00
|
|
|
};
|