private static WireController[] Generate(Level level, PuzzleState cc, GameController controller, GameObject wirePrefab, GameObject[] coins, GameObject[] solCoins) { var wires = new WireController[level.NumCoins]; for (int i = 0; i < level.NumCoins; i++) { int targetCoin = level.solved.FirstIndexForColor(controller.Current.ColorIndex(i)); var wire = (GameObject)Instantiate(controller.wirePrefab); var wcontrol = wire.GetComponent <WireController>() as WireController; if (controller != null) { wcontrol.Attach(controller, coins[i], solCoins[targetCoin]); } wires[i] = wcontrol; } return(wires); }
private void BuildWires() { DestroyWires(); wires = WireController.Generate(this, coins, solutionCoins); }