예제 #1
0
        /// <summary>
        /// 工人到位后开始拆除
        /// </summary>
        /// <param name="commandType"></param>
        /// <param name="finish"></param>
        /// <returns></returns>
        public IEnumerator Remove(BuildCommandType commandType, Action finish)
        {
            switch (commandType)
            {
            case BuildCommandType.RemoveGroundwork:
                if (HaveGroundwork)
                {
                    yield return(StartCoroutine(mGroundworkItem.Remove()));

                    mGroundworkItem = null;
                }
                break;

            case BuildCommandType.RemoveBuildingMaterials:
                if (HaveWall)
                {
                    yield return(StartCoroutine(WallItem.Remove()));

                    WallItem = null;
                    foreach (var item in TilesManager.GetArroundTiles(IndexX, IndexY))
                    {
                        if (item.HaveWall)
                        {
                            item.WallItem.SetWallImage(false);
                        }
                    }
                }
                else if (HaveDoor)
                {
                    yield return(StartCoroutine(DoorItem.Remove()));

                    DoorItem = null;
                    foreach (var item in TilesManager.GetArroundTiles(IndexX, IndexY))
                    {
                        if (item.HaveWall)
                        {
                            item.WallItem.SetWallImage(false);
                        }
                    }
                }
                break;

            case BuildCommandType.RemoveRoom:
                break;

            case BuildCommandType.RemoveDecorate:
                break;
            }
            finish();
        }