2024-07-24 18:00:50 +08:00
|
|
|
|
"PropName": "梦境楼梯",
|
|
|
|
|
"AssetPath": "/Game/Props/SceneProps/Items/BP_Steps.BP_Steps",
|
|
|
|
|
|
|
|
|
|
定义场景A与场景B,A=>B。
|
|
|
|
|
1. 创建一个和A或者B相同的场景道具。使用LevelInstance。
|
|
|
|
|
2. 制作渐变效果,在A或者B溶解完成后,进行一次切换区域。
|
|
|
|
|
1. 或者使用一个其他模型做过度。
|
|
|
|
|
3. 物理问题可以使用 Ignore Component Transform 来解决。
|
|
|
|
|
|
2024-08-12 11:37:59 +08:00
|
|
|
|
manager.LayerManager.EnterLevelArea(this.preset.LevelAreaPreset.UUID, manager.LevelSwitchType);
|
|
|
|
|
|
|
|
|
|
# 角色会隐藏问题解决
|
|
|
|
|
1. TsIdolControllerActor.ts中绑定了若干事件
|
|
|
|
|
```typescript
|
|
|
|
|
RegisterEventListener(): void
|
|
|
|
|
{
|
|
|
|
|
this.ListenerWrapper_SwitchLiveArea = (liveAreaUUID: UE.Guid) => { this.SwitchToLiveArea(liveAreaUUID) }
|
|
|
|
|
this.ListenerWrapper_OnFinishCreateTmpArea = (liveAreaUUID: UE.Guid) => { this.RequireSwitchToLiveArea(liveAreaUUID) }
|
|
|
|
|
this.ListenerWrapper_SceneChanged = (levelName:string)=>{this.OnSceneChanged() };
|
|
|
|
|
this.ListenerWrapper_BeforeSceneChanged = (levelName:string)=>{this.BeforeSceneChanged() };
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.OnFinishSwitchLiveAreaLocal, this.ListenerWrapper_SwitchLiveArea)
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.OnFinishSwitchSubLevelLocal,this.ListenerWrapper_SceneChanged)
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.BeforeSwitchLevel,this.ListenerWrapper_BeforeSceneChanged)
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.OnFinishCreateTmpLiveAreaLocal,this.ListenerWrapper_OnFinishCreateTmpArea)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- ListenerWrapper_SwitchLiveArea:角色移动到其他LiveArea的核心逻辑。
|
|
|
|
|
- ListenerWrapper_OnFinishCreateTmpArea:无逻辑。
|
|
|
|
|
- ListenerWrapper_SceneChanged:卸载所有道具?this.PropComp.OnSceneChanged()
|
|
|
|
|
- ListenerWrapper_BeforeSceneChanged:将角色与衣服从LiveAreaDetach? this.DressModel.K2_DetachFromActor()
|
|
|
|
|
|
|
|
|
|
## ListenerWrapper_SwitchLiveArea
|
|
|
|
|
```c++
|
|
|
|
|
SwitchToLiveArea(TargetLiveAreaGUID: UE.Guid): void {
|
|
|
|
|
console.warn(this.Identity.RootTag.TagName.toString() + ' switch to live area ' + TargetLiveAreaGUID.ToString())
|
|
|
|
|
this.LiveAreaGIUD = TargetLiveAreaGUID
|
|
|
|
|
this.SetTransformToLiveArea()
|
|
|
|
|
if (this.PropComp.DressModel && this.PropComp.DressModel.MovementComp&&this.PropComp.DressModel.MovementComp.ManulMovement) {
|
|
|
|
|
console.warn(this.PropComp.DressModel.GetName() + ' is in free move mode, will not teleport to new area!')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var liveAreaMgr = LiveAreaUtils.GetLievAreaManagerInstance(this)
|
|
|
|
|
if (liveAreaMgr && liveAreaMgr.IsTmpLiveArea(TargetLiveAreaGUID)) {
|
|
|
|
|
// teleport to the target live area without fx
|
|
|
|
|
this.PropComp.Teleport(TargetLiveAreaGUID)
|
|
|
|
|
} else {
|
|
|
|
|
this.PropComp.DressModelTeleport(TargetLiveAreaGUID)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|