コード例 #1
0
    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);
    }
コード例 #2
0
    public bool CheckIfMarkableHexagons()
    {
        HexagonColor color = adjointHexagons[0].color;

        for (int i = 1; i < 3; i++)
        {
            if (adjointHexagons[i].color != color)
            {
                return(false);
            }
        }

        return(true);
    }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
        //--------------------------------------------------------------------------------------------------

        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);
        }
コード例 #5
0
    // 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);
    }
コード例 #6
0
 public void SetColor(HexagonColor _hexagonColor)
 {
     hexagonColor         = _hexagonColor;
     spriteRenderer.color = GetColor().color32;
 }