init
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "PlayerCinematic.h"
|
||||
|
||||
#include "NakedDesireCharacter.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
APlayerCinematic::APlayerCinematic()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
|
||||
NipplesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Nipples"));
|
||||
NipplesMeshComponent->SetupAttachment(GetMesh());
|
||||
AnalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Anal"));
|
||||
AnalMeshComponent->SetupAttachment(GetMesh());
|
||||
VaginaMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Vagina"));
|
||||
VaginaMeshComponent->SetupAttachment(GetMesh());
|
||||
HeadMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Head"));
|
||||
HeadMeshComponent->SetupAttachment(GetMesh());
|
||||
NeckMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Neck"));
|
||||
NeckMeshComponent->SetupAttachment(GetMesh());
|
||||
FaceMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Face"));
|
||||
FaceMeshComponent->SetupAttachment(GetMesh());
|
||||
EyesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Eyes"));
|
||||
EyesMeshComponent->SetupAttachment(GetMesh());
|
||||
BodyMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Body"));
|
||||
BodyMeshComponent->SetupAttachment(GetMesh());
|
||||
TopMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Top"));
|
||||
TopMeshComponent->SetupAttachment(GetMesh());
|
||||
BottomMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bottom"));
|
||||
BottomMeshComponent->SetupAttachment(GetMesh());
|
||||
BraMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bra"));
|
||||
BraMeshComponent->SetupAttachment(GetMesh());
|
||||
PantiesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Panties"));
|
||||
PantiesMeshComponent->SetupAttachment(GetMesh());
|
||||
SocksMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Socks"));
|
||||
SocksMeshComponent->SetupAttachment(GetMesh());
|
||||
ShoesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Shoes"));
|
||||
ShoesMeshComponent->SetupAttachment(GetMesh());
|
||||
}
|
||||
|
||||
void APlayerCinematic::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||
if (!Player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingEquip);
|
||||
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingUnequip);
|
||||
|
||||
for (const UClothingItemData* ClothingItemData : Player->ClothingManager->GetEquippedClothing())
|
||||
{
|
||||
EquipClothing(ClothingItemData);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingEquip(const UClothingItemData* ClothingData)
|
||||
{
|
||||
EquipClothing(ClothingData);
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingUnequip(const UClothingItemData* ClothingData)
|
||||
{
|
||||
UnequipClothing(ClothingData);
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* APlayerCinematic::GetMeshByType(const EClothingSlotType SlotType) const
|
||||
{
|
||||
switch (SlotType)
|
||||
{
|
||||
case EClothingSlotType::Nipples:
|
||||
return NipplesMeshComponent;
|
||||
case EClothingSlotType::Anal:
|
||||
return AnalMeshComponent;
|
||||
case EClothingSlotType::Vagina:
|
||||
return VaginaMeshComponent;
|
||||
case EClothingSlotType::Head:
|
||||
return HeadMeshComponent;
|
||||
case EClothingSlotType::Neck:
|
||||
return NeckMeshComponent;
|
||||
case EClothingSlotType::Face:
|
||||
return FaceMeshComponent;
|
||||
case EClothingSlotType::Eyes:
|
||||
return EyesMeshComponent;
|
||||
case EClothingSlotType::Body:
|
||||
return BodyMeshComponent;
|
||||
case EClothingSlotType::Top:
|
||||
return TopMeshComponent;
|
||||
case EClothingSlotType::Bottom:
|
||||
return BottomMeshComponent;
|
||||
case EClothingSlotType::Bra:
|
||||
return BraMeshComponent;
|
||||
case EClothingSlotType::Panties:
|
||||
return PantiesMeshComponent;
|
||||
case EClothingSlotType::Socks:
|
||||
return SocksMeshComponent;
|
||||
case EClothingSlotType::Shoes:
|
||||
return ShoesMeshComponent;
|
||||
default:
|
||||
return NipplesMeshComponent;
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::EquipClothing(const UClothingItemData* ClothingData)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingData->Info->SkeletalMesh);
|
||||
if (ClothingData->Info->UseLeaderPose)
|
||||
{
|
||||
MeshComponent->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
if (!ClothingData->Info->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingData->Info->Materials)
|
||||
{
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::UnequipClothing(const UClothingItemData* ClothingData)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
Reference in New Issue
Block a user