Пример #1
0
 private void CheckItemForReplace(Item NewItem)
 {
     for (int i = 0; i < MyItems.Count; i++) {
         if (ReplaceItem(NewItem, MyItems[i]))
             i = MyItems.Count;
     }
 }
Пример #2
0
 private bool ReplaceItem(Item Item1, Item Item2)
 {
     if (Item1.Name != Item2.Name)
             return false;
     Item1.Description = Item2.Description;
     Item1.MyTexture = Item2.MyTexture;
     Item1.MyStats = Item2.MyStats;
     return true;
 }
Пример #3
0
 public void AddItem(Item NewItem)
 {
     // first check to stack item
     for (int i = 0; i < MyItems.Count; i++) {
         if (MyItems[i].Name == NewItem.Name) {
             MyItems[i].Quantity++;
             HandleAddItemEvent();
             return;
         }
     }
     // if no item of type, add to list
     MyItems.Add (NewItem);
     HandleAddItemEvent();
 }
Пример #4
0
		public void AddItem(Item NewItem) {
			if (OnAddItem != null) {
				OnAddItem.Invoke();
			}
			// first check to stack item
			for (int i = 0; i < MyItems.Count; i++) {
				if (MyItems[i].Name == NewItem.Name) {
					MyItems[i].Quantity++;
					return;
				}
			}
			// if no item of type, add to list
			MyItems.Add (NewItem);
		}