// Attempt to add the given space to the current dot link public void AddSpace(BoardSpace space) { // already connected, don't allow if (ConnectionExists(space)) { return; } previousConnected = lastConnected; lastConnected = space; // the link's type matches the first dot added if (IsEmpty()) { dotType = space.GetCurrentDot().GetDotType(); } // add the dot currentConnectedSpaces.Add(space); space.GetCurrentDot().Select(); // connect last spaces with the line if (currentConnectedSpaces.Count >= 2) { previousConnected.Connect(lastConnected); } }
// Matches the color of the connection lines to the give dot type public void SetDotType(DotManager.DotType dotType) { for (int i = 0; i < connectionLines.Count; i++) { connectionLines[i].SetType(dotType); } }
// Square was created. Select all dots of given type public void Create(DotManager.DotType dotType) { for (int i = 0; i < board.BoardArray.Count; i++) { for (int k = 0; k < board.BoardArray[i].Count; k++) { BoardSpace curSpace = board.BoardArray[i][k]; DotController curDot = curSpace.GetCurrentDot(); if (curDot.GetDotType().typeID == dotType.typeID) { curDot.Select(); // only add to our toScore list once if (!squareCreated) { toScore.Add(curSpace); } } } } squareCreated = true; Handheld.Vibrate(); }
public void SetType(DotManager.DotType dotType) { line.startColor = dotType.dotColor; line.endColor = dotType.dotColor; }
// Set the type and change the colors public void SetDotType(DotManager.DotType type) { dotType = type; dotSprite.color = type.dotColor; selectionSprite.color = type.dotColor; }