Beispiel #1
0
        protected override IAssignment PrepareNextAssignment()
        {
            IAssignment assignment;

            switch (m_state)
            {
            case State.MoveToItem:
                assignment = new MoveAssignment(this, this.Item.Environment, this.Item.Location, DirectionSet.Exact);
                break;

            case State.CarryItem:
                assignment = new CarryItemAssignment(this, this.Item);
                break;

            case State.Haul:
                assignment = new HaulAssignment(this, m_environment, m_location, m_positioning, this.Item);
                break;

            case State.DropItem:
                assignment = new DropItemAssignment(this, this.Item);
                break;

            default:
                throw new Exception();
            }

            return(assignment);
        }
Beispiel #2
0
        protected override IAssignment PrepareNextAssignment()
        {
            IAssignment assignment;

            switch (m_state)
            {
            case State.MoveToItem:
                assignment = new MoveAssignment(this, this.Item.Environment, this.Item.Location, DirectionSet.Exact);
                break;

            case State.CarryItem:
                assignment = new CarryItemAssignment(this, this.Item);
                break;

            case State.HaulToStockpile:
                if (!m_stockpile.Area.Contains(this.Worker.Location))
                {
                    assignment = new HaulToAreaAssignment(this, m_stockpile.Environment, m_stockpile.Area.ToIntGrid3(), DirectionSet.Exact, this.Item);
                }
                else
                {
                    bool ok;
                    var  l = m_stockpile.FindEmptyLocation(out ok);
                    if (!ok)
                    {
                        throw new Exception();
                    }

                    assignment = new HaulAssignment(this, m_stockpile.Environment, l, DirectionSet.Exact, this.Item);
                }
                break;

            case State.DropItem:
                assignment = new DropItemAssignment(this, this.Item);
                break;

            default:
                throw new Exception();
            }

            return(assignment);
        }