public void SetRandomColor() { int randomColorIndex = rand.Next(Math.Min(GameController.Instance.colorMaterials.Length, colorCount)); meshRenderer.material = GameController.Instance.colorMaterials[randomColorIndex]; color = (HexagonColor)Enum.GetValues(typeof(HexagonColor)).GetValue(randomColorIndex); }
public bool CheckIfMarkableHexagons() { HexagonColor color = adjointHexagons[0].color; for (int i = 1; i < 3; i++) { if (adjointHexagons[i].color != color) { return(false); } } return(true); }
public void SetAs(Hexagon other) { color = other.color; meshRenderer.material = other.meshRenderer.material; isBomb = other.isBomb; if (isBomb) { movesBeforeExplosion = other.movesBeforeExplosion; MakeBomb(false); } else { NotBomb(); } }
//-------------------------------------------------------------------------------------------------- public static HexagonColor[] CreateHexagonColorItems(IList <Common.Color> colors, int cols) { var result = new HexagonColor[colors.Count]; int col = 0, row = 0; for (int index = 0; index < colors.Count; index++) { result[index] = new HexagonColor(colors[index].ToWpfColor(), row, col); col++; if (col >= cols) { row++; col = 0; } } return(result); }
// returns true if all adjoint hexagons are the same color, and marks them, // returns false if they are not the same color public bool CheckAndMarkHexagons() { HexagonColor color = adjointHexagons[0].color; for (int i = 1; i < 3; i++) { if (adjointHexagons[i].color != color) { return(false); } } // check is successful, all hexagons are the same color // mark them and return true foreach (var hex in adjointHexagons) { hex.markedForDestruction = true; hex.particlesOnDestroy.Play(); } return(true); }
public void SetColor(HexagonColor _hexagonColor) { hexagonColor = _hexagonColor; spriteRenderer.color = GetColor().color32; }