示例#1
0
        private void CreateActorObj(ActorModel actor)
        {
            ActorCnf actorCnf = Config.ActorCnf[actor.id];

            //预制体
            GameObject assetGo = LoadHelper.LoadPrefab(actorCnf.prefab.ObjName);
            GameObject actorGo = GameObject.Instantiate(assetGo);

            actorGo.transform.SetParent(ActorRootGo.transform);

            //添加组件
            ActorObj actorObj = actorGo.AddComponent <ActorObj>();

            actorObj.Init(actor, this);

            //保存
            Actors.Add(actor.uid, actorObj);
        }
示例#2
0
        public ActorObj GetActor(int uid)
        {
            if (PlayerActor != null && PlayerActor.Uid == uid)
            {
                return(PlayerActor);
            }
            ActorObj actorObj = null;

            foreach (var item in areaDict)
            {
                actorObj = item.Value.GetActor(uid);
                if (actorObj != null)
                {
                    return(actorObj);
                }
            }
            return(actorObj);
        }