void OnFrostChanged(LayeredBoardPiece piece)
 {
     if (!updatingValues)
     {
         StartCoroutine(UpdateValues());
     }
 }
    protected void SelectAndDestroyTiles()
    {
        ActuallyUsingItem();

        List <Match3BoardPiece>  allBoardPiecesWithTiles = new List <Match3BoardPiece>();
        List <LayeredBoardPiece> frostedBoardPieces      = new List <LayeredBoardPiece>();

        boardLogic.boardData.ApplyActionToAll((boardPiece) => {
            Match3Tile tile = boardPiece.Tile as Match3Tile;
            if (tile != null && !tile.IsMoving && tile.IsDestructible && !tile.IsDestroying && !(tile as NormalTile).IsFrozen())
            {
                allBoardPiecesWithTiles.Add(boardPiece as Match3BoardPiece);
            }

            LayeredBoardPiece frostPiece = (boardPiece as LayeredBoardPiece);
            if (frostPiece != null && frostPiece.NumLayers > 0)
            {
                frostedBoardPieces.Add(frostPiece);
            }
        });

        while (targetBoardPieces.Count < destroyTiles)
        {
            int index;
            if (frostedBoardPieces.Count > 0)
            {
                index = Random.Range(0, frostedBoardPieces.Count);
                targetBoardPieces.Add(frostedBoardPieces[index]);
                frostedBoardPieces.RemoveAt(index);
            }
            else if (allBoardPiecesWithTiles.Count > 0)
            {
                index = Random.Range(0, allBoardPiecesWithTiles.Count);
                targetBoardPieces.Add(allBoardPiecesWithTiles[index]);
                allBoardPiecesWithTiles.RemoveAt(index);
            }
            else
            {
                break;                 // REALLY? THERE AREN'T 3 TILES ON THE BOARD? WHAT HAS THE WORLD COME TO?!?! CURSE YOU CANDY CRUSH SAGA!!!
            }
        }

        StartCoroutine(DestroyStuff());
    }
    protected void DestroyThisStuff(Match3BoardPiece boardPiece)
    {
        LayeredBoardPiece frostPiece = (boardPiece as LayeredBoardPiece);

        if (frostPiece != null && frostPiece.NumLayers > 0 && frostPiece.Tile == null)
        {
            frostPiece.NumLayers--;
        }

        else if (boardPiece.Tile != null)
        {
            if (frostPiece != null && (frostPiece.Tile is SnowTile || frostPiece.Tile is LockedTile || frostPiece.Tile is FreezerTile))
            {
                frostPiece.NumLayers--;
            }

            boardPiece.Tile.Destroy();
        }
    }
	protected void ActionOnFrostDissapear(LayeredBoardPiece boardPiece) 
	{
		frostedBoardPiecesCount--;
		
		CheckWin();
	}
	protected void ActionOnFrostCreate(LayeredBoardPiece boardPiece) 
	{
		frostedBoardPiecesCount += boardPiece.NumLayers;
		totalFrostedBoardPieces = frostedBoardPiecesCount;
	}
	public void OnFrostedPieceLayerDestroyedSndEvent(LayeredBoardPiece boardPiece)
	{
		sndFrostPieceLayerDestroy.PlayQueued();
	}
	void OnFrostChanged(LayeredBoardPiece piece)
	{
		if (!updatingValues) {
			StartCoroutine(UpdateValues());
		}
	}
Exemple #8
0
 public void OnFrostedPieceLayerDestroyedSndEvent(LayeredBoardPiece boardPiece)
 {
     sndFrostPieceLayerDestroy.PlayQueued();
 }
    protected void ActionOnFrostDissapear(LayeredBoardPiece boardPiece)
    {
        frostedBoardPiecesCount--;

        CheckWin();
    }
 protected void ActionOnFrostCreate(LayeredBoardPiece boardPiece)
 {
     frostedBoardPiecesCount += boardPiece.NumLayers;
     totalFrostedBoardPieces  = frostedBoardPiecesCount;
 }