File size: 2,162 Bytes
1e67697 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Engine/World.h"
#include "LyraEquipmentInstance.generated.h"
class AActor;
class APawn;
struct FFrame;
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:
#if UE_WITH_IRIS
/** Register all replication fragments */
virtual void RegisterReplicationFragments(UE::Net::FFragmentRegistrationContext& Context, UE::Net::EFragmentRegistrationFlags RegistrationFlags) override;
#endif // UE_WITH_IRIS
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)
TObjectPtr<UObject> Instigator;
UPROPERTY(Replicated)
TArray<TObjectPtr<AActor>> SpawnedActors;
};
|