File size: 3,081 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Components/ControllerComponent.h"
#include "LyraCharacterPartTypes.h"
#include "LyraControllerComponent_CharacterParts.generated.h"
class APawn;
class ULyraPawnComponent_CharacterParts;
class UObject;
struct FFrame;
enum class ECharacterPartSource : uint8
{
Natural,
NaturalSuppressedViaCheat,
AppliedViaDeveloperSettingsCheat,
AppliedViaCheatManager
};
//////////////////////////////////////////////////////////////////////
// A character part requested on a controller component
USTRUCT()
struct FLyraControllerCharacterPartEntry
{
GENERATED_BODY()
FLyraControllerCharacterPartEntry()
{}
public:
// The character part being represented
UPROPERTY(EditAnywhere, meta=(ShowOnlyInnerProperties))
FLyraCharacterPart Part;
// The handle if already applied to a pawn
FLyraCharacterPartHandle Handle;
// The source of this part
ECharacterPartSource Source = ECharacterPartSource::Natural;
};
//////////////////////////////////////////////////////////////////////
// A component that configure what cosmetic actors to spawn for the owning controller when it possesses a pawn
UCLASS(meta = (BlueprintSpawnableComponent))
class ULyraControllerComponent_CharacterParts : public UControllerComponent
{
GENERATED_BODY()
public:
ULyraControllerComponent_CharacterParts(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
//~UActorComponent interface
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~End of UActorComponent interface
// Adds a character part to the actor that owns this customization component, should be called on the authority only
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Cosmetics)
void AddCharacterPart(const FLyraCharacterPart& NewPart);
// Removes a previously added character part from the actor that owns this customization component, should be called on the authority only
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Cosmetics)
void RemoveCharacterPart(const FLyraCharacterPart& PartToRemove);
// Removes all added character parts, should be called on the authority only
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Cosmetics)
void RemoveAllCharacterParts();
// Applies relevant developer settings if in PIE
void ApplyDeveloperSettings();
protected:
UPROPERTY(EditAnywhere, Category=Cosmetics)
TArray<FLyraControllerCharacterPartEntry> CharacterParts;
private:
ULyraPawnComponent_CharacterParts* GetPawnCustomizer() const;
UFUNCTION()
void OnPossessedPawnChanged(APawn* OldPawn, APawn* NewPawn);
void AddCharacterPartInternal(const FLyraCharacterPart& NewPart, ECharacterPartSource Source);
void AddCheatPart(const FLyraCharacterPart& NewPart, bool bSuppressNaturalParts);
void ClearCheatParts();
void SetSuppressionOnNaturalParts(bool bSuppressed);
friend class ULyraCosmeticCheats;
};
|