/// <summary> /// After deleting an operation we update the compositeUI /// </summary> private void ReSortTiles() { for (int i = 0; i < opList.Count; i++) { GameObject go = opList [i]; OpTile tile = go.GetComponent<OpTile> (); if (tile != null) { if (tile.LastActive.name == "EMPTY" && i <= opList.Count - 2) { GameObject nextGo = opList [i + 1]; OpTile nextTile = nextGo.GetComponent<OpTile> (); if (nextTile.LastActive.name != "EMPTY") { tile.ShowOp (nextTile.LastActive.name); nextTile.DeSelect (); nextTile.ShowOp ("EMPTY"); nextTile.index = -1; tile.index = i; } } } } }
/// <summary> /// Removes the operation from the grid /// </summary> /// <param name="index">Index.</param> public void RemoveOperation(int index) { GameObject go = opList [index]; OpTile tile = go.GetComponent<OpTile> (); tile.DeSelect (); tile.ShowOp ("EMPTY"); tile.index = -1; ReSortTiles (); nextOpIndex--; }
/// <summary> /// Adds the icon of the operation to the grid /// </summary> /// <param name="name">Name.</param> public void AddOperation(string name) { if (nextOpIndex < opLimit) { GameObject nextOperation = opList [nextOpIndex]; OpTile t = nextOperation.GetComponent<OpTile> (); t.index = nextOpIndex; if (t != null) { t.ShowOp (name); nextOpIndex++; } } }