public BuildStep(Point onlyPoint, Building toBuild, FullTask parentList) : base(null, parentList, TaskType.BUILD) { this.ToBuild = toBuild; this.startPoint = onlyPoint; this.endPoint = onlyPoint; checkIfBuildActionMakesSense(); }
public BuildStep(Path path, Building toBuild, FullTask parentList) : base(path, parentList, TaskType.BUILD) { this.ToBuild = toBuild; this.startPoint = path.Start; this.endPoint = path.End; checkIfBuildActionMakesSense(); }
public StockpileStep(Path path, Carryable toDropOff, Building stockpile, FullTask parentList) : base(path, parentList, TaskType.PUT_DOWN) { this.ToDropOff = toDropOff; this.WhereToPlace = stockpile; this.endPoint = path.End; if (Path.Start != StartPoint) throw new ArgumentException("Path doesn't start where we picked up the item!"); }
/// <summary> /// Determines whether or not this Building overlaps a specific other Building /// </summary> /// <param name="b"></param> /// <returns></returns> public bool Overlaps(Building b) { if (this.XMax < b.XMin || b.XMax < this.XMin || this.YMax < b.YMin || b.YMax < this.YMin) { return false; } else { return true; } }
public override void GetPutInStockpile(Building stockpile) { if (!IsBeingCarried) throw new InvalidOperationException("Isn't being carried right now."); carryingPerson = null; intendedCollector = null; currentStockpile = stockpile; this.currentState = CarryableState.IN_STOCKPILE; }
public override void GetPickedUp(InWorldObject picker) { if (!CanBePickedUp) throw new InvalidOperationException("Can't be picked up right now."); this.currentState = CarryableState.CARRIED; carryingPerson = picker; if (IsInStockpile) { Point coord = SquareCoordinate; int x = coord.X; int y = coord.Y; currentStockpile.RemoveObject(x, y, this); currentStockpile = null; } }
/// <summary> /// Get put down in a stockpile. Assumes the current /// state is Carried, and should end (barring weirdness) /// in current state being InStockpile. /// </summary> public abstract void GetPutInStockpile(Building stockpile);