Exemple #1
0
        internal void getStyle(int i, out Color tile, out Color fontColour)
        {
            TileStyle style = getStyle(i);

            fontColour = style.SecondaryTextColour ? secondaryTextColour : primaryTextColour;
            tile       = style.Color;
        }
Exemple #2
0
        public void Back()
        {
            BoardState state = history.Pop();

            if (state == null)
            {
                return;
            }

            foreach (TileState tile in state.tiles)
            {
                if (tile.Points == -1)
                {
                    tilePositions[new BoardPos(tile.grid.X, tile.grid.Y)].setEmpty(emptyTileColor);
                }
                else
                {
                    TileStyle style = getStyle(tile.Points);
                    tilePositions[new BoardPos(tile.grid.X, tile.grid.Y)].setTile(tile.Points, style.Color,
                                                                                  style.SecondaryTextColour ? secondaryTextColour : primaryTextColour, movementSpeed, false);
                }
            }

            if (isEndOfGame())
            {
                SaveSystem.RemoveBoard(boardSize.X, boardSize.Y);
                SaveSystem.SaveScore(score, boardSize.X, boardSize.Y);
                if (GameOver != null)
                {
                    GameOver.gameObject.SetActive(true);
                }
            }
            else
            {
                SaveSystem.SaveBoard(BuildSaveState());
                if (GameOver != null)
                {
                    GameOver.gameObject.SetActive(false);
                }
            }
        }
Exemple #3
0
 internal void AddUnknownStyle(TileStyle style)
 {
     unknownTileStyle = style;
 }
Exemple #4
0
 internal void AddStyle(TileStyle style)
 {
     Styles.Add(style);
 }
Exemple #5
0
        /// <summary>
        /// Sets a specific tile to a either the lowest or second lowest value
        /// </summary>
        /// <param name="tile">tile that will be changed</param>
        /// <param name="forceLow">force the score to be the lowest</param>
        private void SpawnTile(Tile tile, bool forceLow = false)
        {
            TileStyle style = forceLow ? Styles[0] : highScoreSpawn > Random.Range(0, 1) ? Styles[0] : Styles[1];

            tile.setTile(style.score, style.Color, style.SecondaryTextColour ? secondaryTextColour : primaryTextColour, movementSpeed, true);
        }