diff --git a/02-Note/DAWA/ASoul/流程笔记/角色流程.md b/02-Note/DAWA/ASoul/流程笔记/角色流程.md index e604bbb..0818c05 100644 --- a/02-Note/DAWA/ASoul/流程笔记/角色流程.md +++ b/02-Note/DAWA/ASoul/流程笔记/角色流程.md @@ -23,6 +23,49 @@ 7. [x] ~~TsSimpleLevelManager.ts~~ 1. SwitchLiveArea()中调用,只调用了Idol.BeiLa,属于容错语句。 8. ~~CameraDebug.cpp ~~(这个不需求) + +## MotionProcess可疑的地方 +```ts + // #region 角色创建 + static ServerCreateIdolControllerAtLiveArea(World: UE.World, IdolRootTag: UE.GameplayTag, variance:number, LiveAreaGIUD: UE.Guid): TsIdolControllerActor { + let bpClass = UE.Class.Load(this.BluePrintPath) + if (bpClass == null) { + console.error("IdolController BluePrint is null") + return null; + } + + let levelController = TsLevelAreaManager.Get(World) + if (levelController) { + let liveArea = levelController.GetLiveArea(LiveAreaGIUD) + if (liveArea == null) { + console.error("Cannot create idol because of invalid livearea guid!!") + return null; + } + } + + let spawnTransform = new UE.Transform() + let controller = UE.GameplayStatics.BeginDeferredActorSpawnFromClass(World, bpClass, spawnTransform) as TsIdolControllerActor + controller.LiveAreaGIUD = LiveAreaGIUD + if (variance < 0) { + variance = this.GetVarianceNumber(World, IdolRootTag) + } + controller.Identity = new UE.IdolIdentity(IdolRootTag, variance) + controller.visibility = true + var mgr = Utils.GetPropManager(controller.GetWorld()) + controller.Index = mgr.CharacterIndex + mgr.CharacterIndex += 1 + UE.GameplayStatics.FinishSpawningActor(controller, spawnTransform) + controller.SetTransformToLiveArea() + controller.PropComp.ServerLoadPropPreset(0) + DirectorEventSystem.Emit(World, DirectorEvent.CharacterGeneratedServer, controller, controller.Identity.RootTag.TagName) + + console.log("Successfully load " + controller.GetIdentityName()) + return controller + } +``` + + `DirectorEventSystem.Emit(World, DirectorEvent.CharacterGeneratedServer, controller, controller.Identity.RootTag.TagName)` + # AVCharacter 主要实现了`virtual void OnRep_AttachmentReplication() override;`,声明了若干BlueprintNativeEvent: - bool CanSyncRelativeTransform();