Exemplo n.º 1
0
    public void Init(BlockBuilding building, Block45CurMan perfab)
    {
        mBlockBuilding = building;

        Vector3 size;

        List <Vector3> npcPosition;

        List <CreatItemInfo> itemList;

        Dictionary <int, BuildingNpc> npcIdNum;

        mBlockBuilding.GetBuildingInfo(out size, out mBlocks, out npcPosition, out itemList, out npcIdNum);

        BoxCollider col = gameObject.AddComponent <BoxCollider>();

        col.center = 0.5f * size + 0.5f * Vector3.up;
        col.size   = size;

        mB45Building = Instantiate(perfab) as Block45CurMan;
        mB45Building.transform.parent        = transform;
        mB45Building.transform.localPosition = Vector3.zero;
        mB45Building.transform.localRotation = Quaternion.identity;
        mB45Building.transform.localScale    = Vector3.one;

        Invoke("BuildBuilding", 0.5f);

        foreach (CreatItemInfo item in itemList)
        {
            ItemProto itemData = ItemProto.GetItemData(item.mItemId);
//			AssetBundleReq req = AssetBundlesMan.Instance.AddReq(itemData.m_ModelPath, Vector3.zero, Quaternion.identity);
//			req.ReqFinishWithReqHandler += OnSpawned;
//			mReqList[req] = item;

            GameObject go = Instantiate(Resources.Load(itemData.resourcePath)) as GameObject;
            go.transform.parent = transform;
            go.transform.transform.localPosition = item.mPos;
            go.transform.transform.localRotation = item.mRotation;
            go.transform.transform.localScale    = Vector3.one;
        }
    }