Exemple #1
0
        private static IEnumerator CreateActor_Async(ActorCreateRequest rCreateRequest)
        {
            var rAvatarRequest = AvatarAssetLoader.Instance.Load(rCreateRequest.actor.Avatar);

            yield return(rAvatarRequest.Coroutine);

            ExhibitActor rExhibitActor = new ExhibitActor();

            rExhibitActor.Actor              = rCreateRequest.actor;
            rExhibitActor.ActorGo            = rAvatarRequest.avatarGo;
            rExhibitActor.Actor.ExhibitActor = rExhibitActor;

            // 设置ActorGo的大小
            var rHero = rCreateRequest.actor.Hero;

            rExhibitActor.ActorGo.transform.localScale = new Vector3(rHero.Scale, rHero.Scale, rHero.Scale);

            // 添加角色控制器
            var rActorController = rCreateRequest.actor.ActorGo.ReceiveComponent <ActorController>();

            rActorController.Actor = rCreateRequest.actor;

            // 添加角色的技能管理器
            var rActorGamePlayMgr = rCreateRequest.actor.ActorGo.ReceiveComponent <ActorGamePlayManager>();

            rActorGamePlayMgr.Initialize(rCreateRequest.actor);

            UtilTool.SetLayer(rExhibitActor.ActorGo, "Actor", true);

            UtilTool.SafeExecute(rCreateRequest.loadCompleted, rExhibitActor.Actor);
        }
Exemple #2
0
        private static IEnumerator CreateActor_Async(Actor rActor, System.Action <Actor> rLoadCompleted)
        {
            var rAvatarRequest = AvatarAssetLoader.Instance.Load(rActor.Avatar.ABPath, rActor.Avatar.AssetName);

            yield return(rAvatarRequest);

            ExhibitActor rExhibitActor = new ExhibitActor();

            rExhibitActor.Actor              = rActor;
            rExhibitActor.ActorGo            = rAvatarRequest.AvatarGo;
            rExhibitActor.Actor.ExhibitActor = rExhibitActor;

            // 设置ActorGo的大小
            var rHero = rActor.Hero;

            rExhibitActor.ActorGo.transform.localScale = new Vector3(rHero.Scale, rHero.Scale, rHero.Scale);

            // 添加角色控制器
            //var rActorController = rActor.ActorGo.ReceiveHotfixComponent<ActorController>();
            //rActorController.Actor = rActor;

            // 添加角色的技能管理器
            //var rActorGamePlayMgr = rActor.ActorGo.ReceiveHotfixComponent<ActorGamePlayManager>();
            //rActorGamePlayMgr.Initialize(rActor);

            UtilTool.SetLayer(rExhibitActor.ActorGo, "Actor", true);

            UtilTool.SafeExecute(rLoadCompleted, rExhibitActor.Actor);
        }