public virtual float GetAxis(eAXIS axis) { switch (axis) { case eAXIS.AXIS_X: return(CurrentAxis_X); case eAXIS.AXIS_Y: return(CurrentAxis_Y); } return(0); }
private int AddPiecesToBomb(HashSet <Piece> piecesToBomb, eAXIS axis, int i, int j, int count) { if (count >= MIN_BOMB_COUNT) { for (int jj = j - (MIN_BOMB_COUNT - 1); jj <= j; jj++) { var k = -i - jj; piecesToBomb.UnionWith(piecesPerCoord[GetHexPerAxis(axis, i, jj, k)].ReturnPiecesToBomb()); Score += 20; } count = 1; } return(count); }
private static Hex GetHexPerAxis(eAXIS axis, int i, int j, int k) { // z aixs var hex = new Hex(i, k, j); if (axis == eAXIS.X) { hex = new Hex(k, i, j); } else if (axis == eAXIS.Y) { hex = new Hex(k, j, i); } return(hex); }
private HashSet <Piece> CheckMatchingPiecesPerAxis(eAXIS axis) { var piecesToBomb = new HashSet <Piece>(); for (int i = -RADIUS; i <= RADIUS; i++) { var prevType = Shape.eColorType.NONE; var currentType = Shape.eColorType.NONE; int count = 1; int jInitValue = (i <= 0) ? -RADIUS - i : -RADIUS; int jUntilValue = (i <= 0) ? RADIUS : RADIUS - i; for (int j = jInitValue; j <= jUntilValue; j++) { int k = -i - j; var hex = GetHexPerAxis(axis, i, j, k); currentType = piecesPerCoord[hex].ColorType; if (currentType == prevType) { count++; } else { count = 1; } Debug.LogFormat("{0} : {1}, count : {2}", hex.ToVector3(), currentType, count); count = AddPiecesToBomb(piecesToBomb, axis, i, j, count); prevType = currentType; } } return(piecesToBomb); }