public void OnMouseUp() { if (StackPin.SelectedTile != null) { pin.PushTile(StackPin.SelectedTile); } else { pin.PopTile(); } }
public void LoadStackRandom(StackData stack, int stacksToFill, int maxStackPins) { stacksToWin = stacksToFill; if (stacksToFill > maxStackPins) { Debug.LogError("Pins to fill is higher than max pins"); return; } stackPins.Shuffle(); colors.Shuffle(); Color[] randomColors = new Color[stacksToFill]; for (int i = 0; i < stacksToFill; i++) { randomColors[i] = colors[i]; //randomStackpins[i] = stackPins[i]; } for (int j = 0; j < stacksToFill; j++) { int colorCode = j; Color color = randomColors[j]; stack.meshes.Shuffle(); for (int i = 0; i < stack.meshes.Count; i++) { GameObject tile = pooledGameObjects[0]; pooledGameObjects.RemoveAt(0); var stackTile = tile.GetComponent <StackTile>(); stackTile.SetData(stack); stackTile.colorCode = colorCode; stackTile.index = stack.meshes[i].index; stackTile.SetMesh(stack.meshes[i].mesh); stackTile.SetMaterials(stack.materials.ToArray()); stackTile.SetMaterialColor(color); stackPins.Shuffle(); StackPin stackPin = stackPins[0]; stackTile.pinIndex = stackPin.pinIndex; stackPin.PushTile(stackTile.gameObject); } } ActionManager.TriggerEvent(GameEvents.STACK_LOAD_COMPLETE, new Hashtable() { { "level", currentLevel } }); //ActionManager.TriggerEvent(GameEvents.STACK_LOAD_COMPLETE); }
public void LoadStack(StackData stack, PinConfig config, List <Color> colors) { for (int j = 0; j < config.tiles.Count; j++) { var tileInfo = config.tiles[j]; { GameObject tile = pooledGameObjects[0]; pooledGameObjects.RemoveAt(0); var stackTile = tile.GetComponent <StackTile>(); stackTile.SetData(stack); stackTile.colorCode = tileInfo.colorIndex; stackTile.index = tileInfo.size; stackTile.SetMesh(stack.meshes[tileInfo.size - 1].mesh); stackTile.SetMaterials(stack.materials.ToArray()); stackTile.SetMaterialColor(colors[tileInfo.colorIndex]); StackPin stackPin = stackPins[config.pinIndex]; stackTile.pinIndex = stackPin.pinIndex; stackPin.PushTile(stackTile.gameObject); } } }
public void PushInvalid() { pin.PushTile(gameObject); }