// Update is called once per frame void Update() { if (GlobalControls.input.Confirm == UndertaleInput.ButtonState.PRESSED) { List <UnderItem> selectedInv = inventoryColumn ? Inventory.inventory : ItemBox.items; List <UnderItem> otherInv = inventoryColumn ? ItemBox.items : Inventory.inventory; int otherInvCapacity = inventoryColumn ? ItemBox.capacity : Inventory.inventorySize; if (lineIndex < selectedInv.Count) { UnderItem item = selectedInv[lineIndex]; if (otherInv.Count < otherInvCapacity) { if (inventoryColumn) { ItemBox.AddToBox(item.Name); Inventory.RemoveItem(lineIndex); } else { Inventory.AddItem(item.Name); ItemBox.RemoveFromBox(lineIndex); } UnitaleUtil.PlaySound("SeparateSound", "menuconfirm"); } else { UnitaleUtil.PlaySound("SeparateSound", "menumove"); } } else { UnitaleUtil.PlaySound("SeparateSound", "menumove"); } RefreshDisplay(); } else if (GlobalControls.input.Up == UndertaleInput.ButtonState.PRESSED) { lineIndex--; if (lineIndex < 0) { lineIndex = (inventoryColumn ? Inventory.inventorySize : ItemBox.capacity) - 1; } UnitaleUtil.PlaySound("SeparateSound", "menumove"); RefreshDisplay(); } else if (GlobalControls.input.Down == UndertaleInput.ButtonState.PRESSED) { lineIndex++; if (lineIndex >= (inventoryColumn ? Inventory.inventorySize : ItemBox.capacity)) { lineIndex = 0; } UnitaleUtil.PlaySound("SeparateSound", "menumove"); RefreshDisplay(); } else if (GlobalControls.input.Left == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Right == UndertaleInput.ButtonState.PRESSED) { if (lineIndex < Inventory.inventorySize && lineIndex < ItemBox.capacity) { inventoryColumn = !inventoryColumn; UnitaleUtil.PlaySound("SeparateSound", "menumove"); RefreshDisplay(); } } else if (GlobalControls.input.Cancel == UndertaleInput.ButtonState.PRESSED) { UnitaleUtil.PlaySound("SeparateSound", "menumove"); DestroySelf(); } }