893ef1eac2
对应 Issue #32 审查退回(第二次)的4个问题: 1.(重大)移除 InteractionManager 反射调用 SetInteracting,SetInteracting(false) 改由 SystemDriver.OnEffectComplete 协调触发 2.(重大)DoorActor::OnInteractStarted 改为空实现,门开关业务由 EffectManager::ExecuteToggleDoor 驱动 3.(中等)EffectManager::ExecuteCameraReturn 销毁 PushCam 并清空 CachedPushCamera,避免冗余回位 4.(中等)EffectManager::AddToBackpack 添加收集系统集成 TODO 注释 编译验证通过 (UE5.7 ChildHoodEditor Development) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
69 lines
2.3 KiB
C++
69 lines
2.3 KiB
C++
// ChildHood Project - 门 Actor
|
||
// 对应技术方案: docs/technical/交互系统-技术方案.md 第3节(类设计)
|
||
// 职责:门的视觉表现(Mesh 旋转)、交互回调分发
|
||
// 派生自 AInteractableActor,使用 UDoorInteractableComponent 替代基类组件
|
||
|
||
#pragma once
|
||
|
||
#include "CoreMinimal.h"
|
||
#include "Interaction/InteractableActor.h"
|
||
#include "DoorActor.generated.h"
|
||
|
||
class UDoorInteractableComponent;
|
||
|
||
/**
|
||
* ADoorActor
|
||
*
|
||
* 门类型的交互物 Actor。在基类基础上:
|
||
* - 使用 UDoorInteractableComponent 替代 UInteractableComponent
|
||
* - v1.1:门开关业务由 EffectManager::ExecuteToggleDoor 驱动,OnInteractStarted 为空实现
|
||
* - UpdateDoorVisual 执行实际的 Mesh Yaw 旋转(开门+90, 关门0)
|
||
*
|
||
* v0.1 阶段旋转为瞬时 SetRelativeRotation,不使用动画插值。
|
||
*/
|
||
UCLASS()
|
||
class ADoorActor : public AInteractableActor
|
||
{
|
||
GENERATED_BODY()
|
||
|
||
public:
|
||
|
||
ADoorActor();
|
||
|
||
// === 组件访问 ===
|
||
|
||
/** 获取门交互组件 */
|
||
UFUNCTION(BlueprintCallable, Category = "Door")
|
||
UDoorInteractableComponent* GetDoorInteractableComp() const { return DoorInteractableComp; }
|
||
|
||
// === 交互回调 ===
|
||
|
||
/**
|
||
* 交互开始回调(v1.1 为空实现)。
|
||
* 门开关业务逻辑由 EffectManager::ExecuteToggleDoor 统一驱动,
|
||
* 视觉旋转由 UDoorInteractableComponent::ToggleDoor 内部回调,Actor 不在此重复处理。
|
||
*/
|
||
virtual void OnInteractStarted_Implementation(UInteractableComponent* Comp) override;
|
||
|
||
// === 视觉更新 ===
|
||
|
||
/**
|
||
* 更新门 Mesh 的视觉旋转。
|
||
* bIsOpen=true → Yaw +90 度(打开)
|
||
* bIsOpen=false → Yaw 0 度(关闭)
|
||
* 由 UDoorInteractableComponent 在 ToggleDoor/RestorePersistentState 中调用。
|
||
*/
|
||
UFUNCTION(BlueprintCallable, Category = "Door")
|
||
void UpdateDoorVisual(bool bIsOpen);
|
||
|
||
protected:
|
||
|
||
/** 门交互组件(替代基类的 InteractableComp,提供门特有状态和行为) */
|
||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
|
||
TObjectPtr<UDoorInteractableComponent> DoorInteractableComp;
|
||
|
||
/** 门打开时的 Yaw 偏移(度),可在编辑器中调整 */
|
||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Door", meta = (ClampMin = "0", ClampMax = "180"))
|
||
float OpenYawOffset = 90.f;
|
||
};
|