Пример #1
0
 public SleepStep(Point markedPoint, Bedroom markedBedroom, FullTask parentList)
     : base(null, parentList, TaskType.SLEEP)
 {
     this.markedBedroom = markedBedroom;
     this.markedPoint = markedPoint;
     this.WhereToPlace = markedBedroom;
 }
Пример #2
0
        public static FullTask MakeSleepingBedroomTask(Bedroom bedroom, int priority)
        {
            if (!bedroom.HasAvailableSquare(BuildingInteractionType.USE))
                return null;

            FullTask outputTask = new SleepingBedroomTask(priority);

            Point markedPoint = bedroom.GetNextAvailableSquare(BuildingInteractionType.USE);
            bedroom.MarkSquare(markedPoint.X, markedPoint.Y, outputTask, BuildingInteractionType.USE);

            TaskStep step = new SleepStep(markedPoint, bedroom, outputTask);
            outputTask.AddNewTask(step);

            outputTask.Freeze();
            return outputTask;
        }
Пример #3
0
        /// <summary>
        /// Saves the selected dragged block as the relevant kind of building,
        /// if it's a valid selection.  Adds this building to the WorldManager.
        /// </summary>
        private void SaveDraggedBlock()
        {
            Dragging = false;

            WorldManager.MyMap.ClearVisualOverrides();

            int xmin = Math.Min(MouseClickStartSquare.X, MouseClickEndSquare.X);
            int xmax = Math.Max(MouseClickStartSquare.X, MouseClickEndSquare.X);

            int ymin = Math.Min(MouseClickStartSquare.Y, MouseClickEndSquare.Y);
            int ymax = Math.Max(MouseClickStartSquare.Y, MouseClickEndSquare.Y);

            if (WorldManager.IsValidSelection(xmin, xmax, ymin, ymax))
            {
                switch (this.UserMode)
                {
                    case CowMouse.UserMouseMode.MAKE_STOCKPILE:
                        Stockpile pile = new Stockpile(xmin, xmax, ymin, ymax, WorldManager);
                        WorldManager.addBuilding(pile);
                        break;

                    case CowMouse.UserMouseMode.MAKE_BARRIER:
                        Barrier wall = new Barrier(xmin, xmax, ymin, ymax, WorldManager);
                        WorldManager.addBuilding(wall);
                        break;

                    case CowMouse.UserMouseMode.MAKE_BEDROOM:
                        Bedroom bedroom = new Bedroom(xmin, xmax, ymin, ymax, WorldManager);
                        WorldManager.addBuilding(bedroom);
                        break;

                    default:
                        throw new NotImplementedException();
                }
            }
        }