Dwarrowdelf.Client.Stockpile.LocationOk C# (CSharp) Method

LocationOk() public method

public LocationOk ( IntVector3 p, ItemObject ob ) : bool
p IntVector3
ob ItemObject
return bool
        public bool LocationOk(IntVector3 p, ItemObject ob)
        {
            if (!this.Area.Contains(p))
                throw new Exception();

            return GetStack(p) == GetMinStack();
        }

Usage Example

Beispiel #1
0
        protected override void OnAssignmentDone()
        {
            switch (m_state)
            {
            case State.MoveToItem:
                Debug.Assert(this.Item.Location == this.Worker.Location);

                m_state = State.CarryItem;
                break;

            case State.CarryItem:
                Debug.Assert(this.Item.Container == this.Worker);

                m_state = State.HaulToStockpile;
                break;

            case State.HaulToStockpile:
                if (m_stockpile.Area.Contains(this.Worker.Location) && m_stockpile.LocationOk(this.Worker.Location, this.Item))
                {
                    m_state = State.DropItem;
                }
                break;

            case State.DropItem:
                m_state = State.Done;
                SetStatus(JobStatus.Done);
                break;

            default:
                throw new Exception();
            }
        }