Texture getTexture(JewelKind kind) { switch (kind) { case JewelKind.Red: return jewelRed; case JewelKind.Orange: return jewelOrange; case JewelKind.Yellow: return jewelYellow; case JewelKind.Green: return jewelGreen; case JewelKind.Blue: return jewelBlue; case JewelKind.Indigo: return jewelIndigo; case JewelKind.Violet: return jewelViolet; default: return Texture2D.blackTexture; } }
private static void GetMatched( JewelKind kind, ref JewelKind?previous, ref int matched, ref int all) { if (previous == kind) { matched++; var add = matched == Need ? Need : matched > Need ? 1 : 0; all += add; } else { previous = kind; matched = 1; } }
public IEnumerator JewelBoardTestsWithEnumeratorPasses() { // Use the Assert class to test conditions. // Use yield to skip a frame. yield return(null); var actualBoard = new JewelKind[][] { new JewelKind[] { JewelKind.Blue, JewelKind.Green, JewelKind.Blue }, new JewelKind[] { JewelKind.Green, JewelKind.Blue, JewelKind.Green }, new JewelKind[] { JewelKind.Indigo, JewelKind.Red, JewelKind.Yellow }, }; var newBoard = new Board(actualBoard); var bestMove = new Move(0, 1, MoveDirection.Down); var AlternativebestMove = new Move(1, 1, MoveDirection.Up); var Move = newBoard.CalculateBestMoveForBoard(); Debug.LogWarning(" Result : " + newBoard.CalculateBestMoveForBoard()); bool isEqual = Move.IsTheSame(bestMove) || Move.IsTheSame(AlternativebestMove); Assert.AreEqual(isEqual, false, " Move is bad"); }
void SetJewel(int x, int y, JewelKind kind);
internal void SetJewel(int x, int y, JewelKind kind) => this.jewels[x, y] = kind;
void SetJewel(int x, int y, JewelKind kind) { boardData[y * width + x] = kind; }
public JewelKind[] boardData;//debug purpose public MoveResult(Move move, int score,List<JewelData> matchList, JewelKind[] boardData) { this.move = move; this.score = score; this.matchList = matchList; this.boardData = boardData; }