docs(technical): 收集系统技术方案 v1.0:Effect/Action 解耦架构修订
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// ChildHood Project - 通用交互物 Actor 基类
|
||||
// ChildHood Project - 通用交互物 Actor 基类(v1.1 Effect/Action 架构)
|
||||
// 对应技术方案: docs/technical/交互系统-技术方案.md 第3节(类设计)
|
||||
// 职责:持有 Mesh + InteractableComponent,提供可被子类覆盖的交互回调
|
||||
// 核心变更(v0.1 → v1.1):去除门旋转逻辑,只保留干净的基类
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "InteractableActor.generated.h"
|
||||
|
||||
class UInteractableComponent;
|
||||
class UStaticMeshComponent;
|
||||
|
||||
/**
|
||||
* AInteractableActor
|
||||
@@ -21,7 +23,7 @@ class UInteractableComponent;
|
||||
* - UInteractableComponent* InteractableComp(交互逻辑与数据)
|
||||
*
|
||||
* 子类可覆盖 OnInteractStarted / OnInteractEnded 以实现类型特定行为,
|
||||
* 如门开关时的 Mesh 旋转、拾取物的消失效果等。
|
||||
* 如门开关时的 Mesh 旋转(ADoorActor)、拾取物的消失效果等。
|
||||
*/
|
||||
UCLASS()
|
||||
class AInteractableActor : public AActor
|
||||
@@ -45,15 +47,20 @@ public:
|
||||
// === 可被子类覆盖的交互回调 ===
|
||||
|
||||
/**
|
||||
* 交互开始时调用(门开关切换、状态恢复时也调用)。
|
||||
* 默认实现:门类型根据开关状态对 Mesh 做 Yaw 旋转(开门+90度/关门0度)。
|
||||
* 交互开始时调用。
|
||||
* BlueprintNativeEvent,子类可在蓝图中或 C++ 中覆盖实现。
|
||||
* 默认为空实现。
|
||||
*/
|
||||
UFUNCTION(BlueprintNativeEvent, Category = "Interact")
|
||||
UFUNCTION(BlueprintNativeEvent, Category = "Interact", meta = (DisplayName = "On Interact Started"))
|
||||
void OnInteractStarted(UInteractableComponent* Comp);
|
||||
virtual void OnInteractStarted_Implementation(UInteractableComponent* Comp);
|
||||
|
||||
/** 交互结束时调用。默认为空实现,子类可覆盖。 */
|
||||
UFUNCTION(BlueprintNativeEvent, Category = "Interact")
|
||||
/**
|
||||
* 交互结束时调用。
|
||||
* BlueprintNativeEvent,子类可在蓝图中或 C++ 中覆盖实现。
|
||||
* 默认为空实现。
|
||||
*/
|
||||
UFUNCTION(BlueprintNativeEvent, Category = "Interact", meta = (DisplayName = "On Interact Ended"))
|
||||
void OnInteractEnded(UInteractableComponent* Comp);
|
||||
virtual void OnInteractEnded_Implementation(UInteractableComponent* Comp);
|
||||
|
||||
@@ -61,9 +68,9 @@ protected:
|
||||
|
||||
/** 交互物的可视模型 */
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
|
||||
UStaticMeshComponent* MeshComp;
|
||||
TObjectPtr<UStaticMeshComponent> MeshComp;
|
||||
|
||||
/** 交互物的交互组件(数据 + 检测 + 状态) */
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
|
||||
UInteractableComponent* InteractableComp;
|
||||
TObjectPtr<UInteractableComponent> InteractableComp;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user