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>
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
// ChildHood Project - 门 Actor 实现
|
|
|
|
#include "Interaction/DoorActor.h"
|
|
#include "Interaction/DoorInteractableComponent.h"
|
|
#include "Interaction/InteractableComponent.h"
|
|
#include "ChildHood.h"
|
|
|
|
// ============================================================================
|
|
// 构造函数
|
|
// ============================================================================
|
|
|
|
ADoorActor::ADoorActor()
|
|
{
|
|
PrimaryActorTick.bCanEverTick = false;
|
|
|
|
// 创建门专用交互组件,赋值给基类指针
|
|
DoorInteractableComp = CreateDefaultSubobject<UDoorInteractableComponent>(TEXT("DoorInteractableComp"));
|
|
InteractableComp = DoorInteractableComp;
|
|
}
|
|
|
|
// ============================================================================
|
|
// 交互回调
|
|
// ============================================================================
|
|
|
|
void ADoorActor::OnInteractStarted_Implementation(UInteractableComponent* Comp)
|
|
{
|
|
(void)Comp; // 参数保留以匹配基类签名(OnInteractStarted 当前无调用方)
|
|
|
|
// v1.1 架构:门的开关业务逻辑由 EffectManager::ExecuteToggleDoor 统一驱动,
|
|
// 视觉旋转由 UDoorInteractableComponent::ToggleDoor 内部回调 UpdateDoorVisual 完成。
|
|
// 此处保留空实现,避免与 Effect 路径重复 ToggleDoor 导致状态抵消。
|
|
}
|
|
|
|
// ============================================================================
|
|
// 视觉更新
|
|
// ============================================================================
|
|
|
|
void ADoorActor::UpdateDoorVisual(bool bIsOpen)
|
|
{
|
|
if (!MeshComp) return;
|
|
|
|
// 瞬时旋转:开门偏移 OpenYawOffset 度,关门回到 0 度
|
|
const float TargetYaw = bIsOpen ? OpenYawOffset : 0.f;
|
|
MeshComp->SetRelativeRotation(FRotator(0.f, TargetYaw, 0.f));
|
|
|
|
UE_LOG(LogChildHood, Verbose, TEXT("DoorActor Visual: Yaw=%.0f (%s)"),
|
|
TargetYaw, bIsOpen ? TEXT("Open") : TEXT("Closed"));
|
|
}
|