RealtimeStyleTransferRuntime/Source/LyraGame/Equipment/LyraEquipmentInstance.h

69 lines
1.9 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "System/GameplayTagStack.h"
#include "GameFramework/Pawn.h"
#include "LyraEquipmentInstance.generated.h"
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:
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)
UObject* Instigator;
UPROPERTY(Replicated)
TArray<AActor*> SpawnedActors;
};