Beispiel #1
0
        public void DropItemOnTerrain(Item i) // ---> Drop 'i' on grid.
        {
            Item other = GetItemAt(i.position.X, i.position.Y, i.position.Z);

            if (other != null)
            {
                if (other is Pile p)  // ---> put in existing pile or make new pile
                {
                    p.Container.Add(i);
                    return;
                }
                else
                { //       Making a new pile, adding both items and register
                    Pile newPile = new Pile(this, i.position);
                    newPile.Container.Add(other);
                    newPile.Container.Add(i);

                    ItemDictionary[newPile.ID] = newPile;
                    ItemGrid[newPile.position.X, newPile.position.Y, newPile.position.Z] = newPile.ID;
                    return;
                }
            }

            else   //  ---> empty grid, insert new item
            {
                // Register item on grid. Register in lookuptable
                ItemDictionary[i.ID] = i;
                ItemGrid[i.position.X, i.position.Y, i.position.Z] = (i.ID);
            }
        }
Beispiel #2
0
 public PileManagerState(Actor actor, Pile pile)
 {
     this.actor = actor;
     this.pile  = pile;
 }