public void SelectRight() { if (_selectedIndex < Shelves.Count - 1) { Selected = Shelves[++_selectedIndex]; Selection.transform.position = Selected.Frame.transform.position + new Vector3(0, -0.24F, 0); } }
public void SelectLeft() { if (_selectedIndex > 0) { Selected = Shelves[--_selectedIndex]; Selection.transform.position = Selected.Frame.transform.position + new Vector3(0, -0.24F, 0); } }
// Use this for initialization void Start() { _selectedIndex = 0; if (Shelves.Count > 0) { Selected = Shelves[_selectedIndex]; Selection.transform.position = Selected.Frame.transform.position + new Vector3(0, -0.24F, 0); } }
public int Add(int amount, ShelfDisplay shelf = null) { shelf = shelf != null ? shelf : Selected; var sum = shelf.CurrentAmount + amount; shelf.CurrentAmount = Math.Min(shelf.Shelf.TotalAmount, sum); if (sum < shelf.Shelf.TotalAmount) { return(0); } // show particel effect for excess of coins var tomuch = sum - shelf.Shelf.TotalAmount; shelf.TooMuch(tomuch); return(tomuch); }