Пример #1
0
        protected virtual void addObj(GameObject obj, GameObjectInfo info)
        {
            obj.transform.parent = _parent.transform;
            obj.GetComponent <BaseAttributes>().objectId = info.objectId;
            obj.GetComponent <BaseAttributes>().aoId     = info.aoId;
            obj.GetComponent <BaseAttributes>().groupId  = info.groupId;
            obj.GetComponent <BaseAttributes>().isNetObj = info.isNetObj;
            GameObjectController controller = obj.GetComponent <GameObjectController>();

            controller.InitControllerInfo();
            _listObj.Add(obj);
            _mapObj.Add(info.aoId, obj);

            //将对象添加到对应的区块位置中
            controller.On_ChangeChunk += HandleOn_ChangeChunk;
            List <GameObject> list;
            WorldPos          pos = controller.gameObjectState.attachChunk.worldPos;

            _mapChunkPosObj.TryGetValue(pos, out list);
            if (list == null)
            {
                list = new List <GameObject>();
                _mapChunkPosObj.Add(pos, list);
            }
            list.Add(obj);
        }
Пример #2
0
        protected override void addObj(GameObject obj, GameObjectInfo info)
        {
            NPCInfo npcInfo = info as NPCInfo;

            obj.GetComponent <NPCAttributes>().NPCType = npcInfo.NPCType;
            obj.GetComponent <NPCAttributes>().taskId  = npcInfo.taskId;
            obj.GetComponent <NPCAttributes>().stepId  = npcInfo.stepId;
            base.addObj(obj, info);
            if (info.objectId == 3)
            {
                obj.GetComponent <GONPCController>().HideAvatar();
            }
        }