2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Containers/Array.h"
|
|
|
|
#include "Engine/World.h"
|
|
|
|
#include "Templates/SubclassOf.h"
|
|
|
|
#include "UObject/Object.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
#include "LyraEquipmentInstance.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class AActor;
|
|
|
|
class APawn;
|
|
|
|
struct FFrame;
|
2022-05-23 18:41:30 +00:00
|
|
|
struct FLyraEquipmentActorToSpawn;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ULyraEquipmentInstance
|
|
|
|
*
|
|
|
|
* A piece of equipment spawned and applied to a pawn
|
|
|
|
*/
|
|
|
|
UCLASS(BlueprintType, Blueprintable)
|
|
|
|
class ULyraEquipmentInstance : public UObject
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
ULyraEquipmentInstance(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
|
|
|
|
//~UObject interface
|
|
|
|
virtual bool IsSupportedForNetworking() const override { return true; }
|
|
|
|
virtual UWorld* GetWorld() const override final;
|
|
|
|
//~End of UObject interface
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintPure, Category=Equipment)
|
|
|
|
UObject* GetInstigator() const { return Instigator; }
|
|
|
|
|
|
|
|
void SetInstigator(UObject* InInstigator) { Instigator = InInstigator; }
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintPure, Category=Equipment)
|
|
|
|
APawn* GetPawn() const;
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintPure, Category=Equipment, meta=(DeterminesOutputType=PawnType))
|
|
|
|
APawn* GetTypedPawn(TSubclassOf<APawn> PawnType) const;
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintPure, Category=Equipment)
|
|
|
|
TArray<AActor*> GetSpawnedActors() const { return SpawnedActors; }
|
|
|
|
|
|
|
|
virtual void SpawnEquipmentActors(const TArray<FLyraEquipmentActorToSpawn>& ActorsToSpawn);
|
|
|
|
virtual void DestroyEquipmentActors();
|
|
|
|
|
|
|
|
virtual void OnEquipped();
|
|
|
|
virtual void OnUnequipped();
|
|
|
|
|
|
|
|
protected:
|
2022-09-13 07:18:28 +00:00
|
|
|
#if UE_WITH_IRIS
|
|
|
|
/** Register all replication fragments */
|
|
|
|
virtual void RegisterReplicationFragments(UE::Net::FFragmentRegistrationContext& Context, UE::Net::EFragmentRegistrationFlags RegistrationFlags) override;
|
|
|
|
#endif // UE_WITH_IRIS
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
UFUNCTION(BlueprintImplementableEvent, Category=Equipment, meta=(DisplayName="OnEquipped"))
|
|
|
|
void K2_OnEquipped();
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintImplementableEvent, Category=Equipment, meta=(DisplayName="OnUnequipped"))
|
|
|
|
void K2_OnUnequipped();
|
|
|
|
|
|
|
|
private:
|
|
|
|
UFUNCTION()
|
|
|
|
void OnRep_Instigator();
|
|
|
|
|
|
|
|
private:
|
|
|
|
UPROPERTY(ReplicatedUsing=OnRep_Instigator)
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<UObject> Instigator;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UPROPERTY(Replicated)
|
2022-09-13 07:18:28 +00:00
|
|
|
TArray<TObjectPtr<AActor>> SpawnedActors;
|
2022-05-23 18:41:30 +00:00
|
|
|
};
|