144 lines
4.3 KiB
C++
144 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "BooleanCutTool.h"
|
|
#include "DismembermentComponent.generated.h"
|
|
|
|
// Forward declarations
|
|
class USplatterMapSystem;
|
|
class UInternalOrganSystem;
|
|
class UBloodSystem;
|
|
|
|
/**
|
|
* Dismemberment component for the FLESH plugin
|
|
* Provides a central control point for all dismemberment systems
|
|
*/
|
|
UCLASS(ClassGroup=(FLESH), meta=(BlueprintSpawnableComponent))
|
|
class FLESH_API UDismembermentComponent : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this component's properties
|
|
UDismembermentComponent();
|
|
|
|
protected:
|
|
// Called when the game starts
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
/**
|
|
* Perform dismemberment at the specified location
|
|
* @param CutPlane - Cut plane
|
|
* @param BoneName - Optional bone name to guide the cut
|
|
* @param bCreateCap - Whether to create a cap
|
|
* @param CapMethod - Method to generate cap mesh
|
|
* @return Whether the dismemberment was successful
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
bool PerformDismemberment(const FCutPlane& CutPlane, FName BoneName = NAME_None, bool bCreateCap = true, ECapMeshMethod CapMethod = ECapMeshMethod::TriangleFan);
|
|
|
|
/**
|
|
* Perform multi-layer dismemberment at the specified location
|
|
* @param CutPlane - Cut plane
|
|
* @param bCreateCap - Whether to create a cap
|
|
* @param CapMethod - Method to generate cap mesh
|
|
* @return Whether the dismemberment was successful
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
bool PerformMultiLayerDismemberment(const FCutPlane& CutPlane, bool bCreateCap = true, ECapMeshMethod CapMethod = ECapMeshMethod::TriangleFan);
|
|
|
|
/**
|
|
* Apply wound at the specified location
|
|
* @param Location - World location of the wound
|
|
* @param Normal - Surface normal at the wound location
|
|
* @param Size - Size of the wound
|
|
* @param Depth - Depth of the wound (0.0-1.0)
|
|
* @param Bloodiness - Bloodiness of the wound (0.0-1.0)
|
|
* @param Bruising - Bruising of the wound (0.0-1.0)
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
void ApplyWound(const FVector& Location, const FVector& Normal, float Size, float Depth = 1.0f, float Bloodiness = 1.0f, float Bruising = 0.5f);
|
|
|
|
/**
|
|
* Get the boolean cut tool
|
|
* @return The boolean cut tool
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
UBooleanCutTool* GetBooleanCutTool() const;
|
|
|
|
/**
|
|
* Get the splatter map system
|
|
* @return The splatter map system
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
USplatterMapSystem* GetSplatterMapSystem() const;
|
|
|
|
/**
|
|
* Get the internal organ system
|
|
* @return The internal organ system
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
UInternalOrganSystem* GetInternalOrganSystem() const;
|
|
|
|
/**
|
|
* Get the blood system
|
|
* @return The blood system
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
UBloodSystem* GetBloodSystem() const;
|
|
|
|
/**
|
|
* Set cut material
|
|
* @param Material - Cut material
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
void SetCutMaterial(UMaterialInterface* Material);
|
|
|
|
/**
|
|
* Set inner material
|
|
* @param Material - Inner material
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
void SetInnerMaterial(UMaterialInterface* Material);
|
|
|
|
/**
|
|
* Set cap mesh method
|
|
* @param Method - Cap mesh method
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Dismemberment")
|
|
void SetCapMeshMethod(ECapMeshMethod Method);
|
|
|
|
private:
|
|
// Boolean cut tool
|
|
UPROPERTY()
|
|
TObjectPtr<UBooleanCutTool> BooleanCutTool;
|
|
|
|
// Splatter map system
|
|
UPROPERTY()
|
|
TObjectPtr<USplatterMapSystem> SplatterMapSystem;
|
|
|
|
// Internal organ system
|
|
UPROPERTY()
|
|
TObjectPtr<UInternalOrganSystem> InternalOrganSystem;
|
|
|
|
// Blood system
|
|
UPROPERTY()
|
|
TObjectPtr<UBloodSystem> BloodSystem;
|
|
|
|
// Skeletal mesh component
|
|
UPROPERTY()
|
|
TObjectPtr<USkeletalMeshComponent> SkeletalMeshComponent;
|
|
|
|
// Inner skeletal mesh component (for multi-layer dismemberment)
|
|
UPROPERTY()
|
|
TObjectPtr<USkeletalMeshComponent> InnerSkeletalMeshComponent;
|
|
|
|
// Find skeletal mesh components
|
|
void FindSkeletalMeshComponents();
|
|
};
|