Beispiel #1
0
        /// <summary>
        /// 预建造
        /// </summary>
        /// <param name="commandType"></param>
        /// <param name="item"></param>
        /// <param name="contents">建造物所包含的格子(房间等占多个格子)</param>
        public void PreBuild(BuildCommandType commandType, BuildingItem item, List <TileItem> contents = null)
        {
            //生成新的建造物并放置在指定层
            switch (commandType)
            {
            case BuildCommandType.BuildGroundwork:
                mGroundworkItem = (GroundworkItem)item;
                mGroundworkItem.BindTileItem(this);
                break;

            case BuildCommandType.BuildWall:
                WallItem = (WallItem)item;
                WallItem.BindTileItem(this);
                if (BelongRoom)     //在已有房间内建墙,墙壁不属于房间的一部分
                {
                    RoomItem.UnBindTileItem(this);
                    RoomItem = null;
                }
                break;

            case BuildCommandType.BuildDoor:
                DoorItem = (DoorItem)item;
                DoorItem.BindTileItem(this);
                break;

            case BuildCommandType.BuildRoom:
                RoomItem = (RoomItem)item;
                RoomItem.BindTileItem(contents);
                break;

            case BuildCommandType.BuildDecorate:
                break;
            }

            mPreBuildingItem = item;
            mPreBuildingItem.PreBuild();
        }