Ejemplo n.º 1
0
        public new void RemoveAt(int index)
        {
            var e = base[index];

            base.RemoveAt(index);
            ItemRemove?.Invoke(e, index);
        }
Ejemplo n.º 2
0
    public static void RemoveItem(Item item, float fTime = 0f)
    {
        Assert.IsTrue(item.isServer, "RemoveItem: Removing a client item!");
        ItemRemove item2 = default(ItemRemove);

        item2.item = item;
        item2.time = Time.time + fTime;
        ItemRemoves.Add(item2);
    }
Ejemplo n.º 3
0
        public virtual bool Remove(TItem item)
        {
            var result = _Items.Remove(item);

            if (result)
            {
                //var handlers = ItemRemove;
                //if (handlers != null)
                //    handlers(item);

                ItemRemove?.Invoke(item);
            }

            return(result);
        }
Ejemplo n.º 4
0
    //Removes the item from the inventory list then drops the item. Turns on colliders to make it the same as it was before. Activating the object in the view
    public void RemoveItem(TheInventoryItem item)
    {
        //Debug.Log("This is the remove item");
        if (myItems.Contains(item))
        {
            myItems.Remove(item);

            item.OnDrop();

            //Debug.Log("This is the ondrop");
            Collider collider = (item as MonoBehaviour).GetComponent <Collider>();
            if (collider != null)
            {
                collider.enabled = true;
            }

            ItemRemove?.Invoke(this, new InventoryEventArgs(item));
        }
    }
Ejemplo n.º 5
0
		public void Drop(Model.Item item, int count = 0, ItemRemove type = ItemRemove.Drop, Library.Point? point = null)
		{
			if (State == State.World)
			{
				if (item != null && item.InInventory)
				{
					if (count <= 0 || count > item.Count)
						count = item.Count;

					switch (type)
					{
						case ItemRemove.Drop:
							Library.Point _point = point.HasValue ? point.Value : World.Me.Position;
							Network.Send(new Packet.Client.RequestDropItem()
							{
								ObjectId = item.ObjectId,
								Count = count,
								Point = _point
							});
							break;
						case ItemRemove.Destroy:
							Network.Send(new Packet.Client.RequestDestroyItem()
							{
								ObjectId = item.ObjectId,
								Count = count,
							});
							break;
						case ItemRemove.Crystallize:
							Network.Send(new Packet.Client.RequestCrystallizeItem()
							{
								ObjectId = item.ObjectId,
								Count = count,
							});
							break;
					}
				}
			}
			else
				throw new Library.Exception.StateException();
		}
Ejemplo n.º 6
0
		public void Drop(int objectId, int count = 0, ItemRemove type = ItemRemove.Drop, Library.Point? point = null)
		{
			if (State == State.World)
			{
				if (objectId != 0)
				{
					var item = World[objectId] as Model.Item;
					if (item != null)
						Drop(item, count, type, point);
				}
			}
			else
				throw new Library.Exception.StateException();
		}