示例#1
0
    public void InitEdit()
    {
        mIsActive = true;
        if (mPerfab == null)
        {
            mPerfab = Block45CurMan.self;
        }
        for (int i = 0; i < mTownDataList.Count; i++)
        {
            BlockBuilding building = BlockBuilding.GetBuilding(mTownDataList[i].mBuildingId);

            GameObject editObj = new GameObject();
            editObj.name = "EditBuilding";
            editObj.transform.position   = mTownDataList[i].mPosition;
            editObj.transform.rotation   = Quaternion.Euler(0, mTownDataList[i].mRot * 90, 0);
            editObj.transform.localScale = Vector3.one;

            EditBuilding editBuilding = editObj.AddComponent <EditBuilding>();
            editBuilding.Init(building, mPerfab);
            mEditBuildingList.Add(editBuilding);
        }
    }
示例#2
0
    public void OnCreateBuilding(string fileName)
    {
        if (mPerfab == null)
        {
            mPerfab = Block45CurMan.self;
        }
        BlockBuilding building = BlockBuilding.GetBuilding(fileName);

        GameObject editObj = new GameObject();

        editObj.name = "EditBuilding";
        editObj.transform.position   = Vector3.zero;
        editObj.transform.rotation   = Quaternion.identity;
        editObj.transform.localScale = Vector3.one;

        EditBuilding editBuilding = editObj.AddComponent <EditBuilding>();

        editBuilding.Init(building, mPerfab);

        mEditBuildingList.Add(editBuilding);

        OnBuildingSelected(editBuilding);
        mDragMode = true;
    }