public async override System.Threading.Tasks.Task <GActor> Clone(CRenderContext rc) { var result = new GPrefab(); //var result = new GCloneActor(); var init = Initializer.CloneObject() as GActorInitializer; init.ActorId = Guid.NewGuid(); result.SetInitializer(init); if (CenterData != null) { Rtti.MetaClass.CopyData(CenterData, result.CenterData); } for (int i = 0; i < Components.Count; ++i) { var comp = await Components[i]?.CloneComponent(rc, result, result); result.AddComponent(comp); } for (int i = 0; i < Children.Count; ++i) { var actor = await Children[i].Clone(rc); actor.SetParent(result); actor.OnActorLoaded(); } result.OnActorLoaded(); result.OnPlacementChanged(result.Placement); result.WaitContext.Result = result; result.WaitContext.SetFinished(WaitContext.IsFinished); return(result); }
public async System.Threading.Tasks.Task <GActor> ConvertToActor(CRenderContext rc) { var result = new GActor(); var init = Initializer.CloneObject() as GActorInitializer; init.ActorId = Guid.NewGuid(); result.SetInitializer(init); for (int i = 0; i < Components.Count; ++i) { var comp = await Components[i]?.CloneComponent(rc, result, result); result.AddComponent(comp); } foreach (var i in Children) { var actor = await i.Clone(rc); actor.SetParent(result); actor.OnActorLoaded(); } result.OnActorLoaded(); return(result); }