refactor(interaction): 适配v1.1架构的角色/管理器/交互物改动

- Character: 替换UInteractionManager为UInteractionPromptComponent
- GameInstance: 空壳化,持久数据迁移至PersistenceSubsystem
- InteractionManager: 重写为普通C++ FInteractionManager
- InteractableComponent: 碰撞回调接入ASystemDriver注册

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 23:21:46 +08:00
parent 4bf678b937
commit c14c63f30d
7 changed files with 391 additions and 1085 deletions
@@ -3,6 +3,8 @@
#include "Interaction/InteractableComponent.h"
#include "Interaction/InteractableActor.h"
#include "Interaction/PersistenceSubsystem.h"
#include "SystemDriver.h"
#include "Interaction/InteractionManager.h"
#include "ChildHood.h"
#include "Components/SphereComponent.h"
@@ -10,10 +12,6 @@
#include "GameFramework/GameInstance.h"
#include "GameFramework/Character.h"
// 前向声明对应的头文件在.cpp中include
// ASystemDriver 在 Phase 2 创建,此处前向声明即可
class ASystemDriver;
// ============================================================================
// 构造函数
// ============================================================================
@@ -164,9 +162,15 @@ void UInteractableComponent::OnDetectionOverlapBegin(UPrimitiveComponent* Overla
UE_LOG(LogChildHood, Verbose, TEXT("检测到角色进入范围: %s ← %s"),
*Data.DisplayName, *OtherActor->GetName());
// Phase 2 将改为通过 ASystemDriver::Get(GetWorld())->GetInteractionManager().RegisterInteractable(this)
// 当前 Phase 1 仅记录日志,因为 FInteractionManager 尚未创建
// TODO(Phase 2): 替换为 ASystemDriver 路径
// 通过 ASystemDriver 注册到 InteractionManager
if (ASystemDriver* Driver = ASystemDriver::Get(this))
{
Driver->GetInteractionManager().RegisterInteractable(this);
}
else
{
UE_LOG(LogChildHood, Warning, TEXT("InteractableComponent: ASystemDriver 不存在,无法注册 %s"), *Data.DisplayName);
}
}
void UInteractableComponent::OnDetectionOverlapEnd(UPrimitiveComponent* OverlappedComponent,
@@ -182,7 +186,9 @@ void UInteractableComponent::OnDetectionOverlapEnd(UPrimitiveComponent* Overlapp
UE_LOG(LogChildHood, Verbose, TEXT("角色离开范围: %s ← %s"),
*Data.DisplayName, *OtherActor->GetName());
// Phase 2 将改为通过 ASystemDriver::Get(GetWorld())->GetInteractionManager().UnregisterInteractable(this)
// 当前 Phase 1 仅记录日志,因为 FInteractionManager 尚未创建
// TODO(Phase 2): 替换为 ASystemDriver 路径
// 通过 ASystemDriver 从 InteractionManager 注销
if (ASystemDriver* Driver = ASystemDriver::Get(this))
{
Driver->GetInteractionManager().UnregisterInteractable(this);
}
}