Пример #1
0
        private void Listener_KeyPressed(object sender, KeyboardEventArgs e)
        {
            if (e.Key == Microsoft.Xna.Framework.Input.Keys.Escape)
            {
                this.HandleEscapeKey();
            }
            if (e.Key == Microsoft.Xna.Framework.Input.Keys.R)
            {
                Point2D result = ItemFinder.FindNearestLocation(0, new MagicalLifeAPI.DataTypes.Point2D(0, 0), 0);

                if (result != null)
                {
                    ItemAdder.AddItem(new StoneChunk(0), result, 0);
                    ItemAdder.AddItem(new StoneChunk(0), result, 0);
                    ItemRemover.RemoveSome(result, 0, 1);
                    ItemRemover.RemoveAllItems(result, 0);
                }
            }
        }
Пример #2
0
 public override void Tick(Living l)
 {
     lock (this.SyncObject)
     {
         if (this.MoveTaskCompleted)
         {
             //Pick it up
             Item pickedUp = ItemRemover.RemoveAllItems(this.ReservedItemLocation, l.Dimension);
             pickedUp.ReservedID = Guid.Empty;
             l.Inventory.AddItem(pickedUp);
             this.CompleteTask();
         }
         else
         {
             //Move closer to it
             this.Move.Tick(l);
         }
     }
 }