private void ClearBoard() { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { ClearPieceAt(i, j); if (m_particleManager != null) { m_particleManager.ClearPieceFXAt(i, j); } } } }
void ClearBoard() { for (int i = 0; i < _width; i++) { for (int j = 0; j < _height; j++) { ClearPieceAt(i, j); if (_particlManager != null) { _particlManager.ClearPieceFXAt(i, j); } } } }
void ClearPieceAt(List <GamePiece> gamePieces, List <GamePiece> bombedPieces) { foreach (var piece in gamePieces) { if (piece != null) { ClearPieceAt(piece.xIndex, piece.yIndex); int bonus = 0; if (gamePieces.Count >= 4) { bonus = 20; } piece.ScorePoints(m_scoreMultiplier, bonus); if (m_particleManager != null) { if (bombedPieces.Contains(piece)) { m_particleManager.BombFXAt(piece.xIndex, piece.yIndex); } else { m_particleManager.ClearPieceFXAt(piece.xIndex, piece.yIndex); } } } } }
// clear a list of GamePieces (plus a potential sublist of GamePieces destroyed by bombs) void ClearPieceAt(List <GamePiece> gamePieces, List <GamePiece> bombedPieces) { foreach (GamePiece piece in gamePieces) { if (piece != null) { // clear the GamePiece ClearPieceAt(piece.xIndex, piece.yIndex); // add a score bonus if we clear four or more pieces int bonus = 0; if (gamePieces.Count >= 4) { bonus = 20; } piece.ScorePoints(m_scoreMultiplier, bonus); // play particle effects for pieces... if (m_particleManager != null) { // ... cleared by bombs if (bombedPieces.Contains(piece)) { m_particleManager.BombFXAt(piece.xIndex, piece.yIndex); } // ... cleared normally else { m_particleManager.ClearPieceFXAt(piece.xIndex, piece.yIndex); } } } } }
private void ClearPieceAt(List <GamePiece> gamePieces, List <GamePiece> bombedPieces) { foreach (GamePiece piece in gamePieces) { if (piece != null) { ClearPieceAt(piece.xIndex, piece.yIndex); int bonus = 0; if (gamePieces.Count >= 4) { bonus = 20; } if (GameManager.Instance != null) { GameManager.Instance.ScorePoints(piece, scoreMultiplier, bonus); TimeBonus timeBonus = piece.GetComponent <TimeBonus>(); if (timeBonus != null) { GameManager.Instance.AddTime(timeBonus.bonusValue); // Debug.Log("Board: adding time bonus from" + // piece.name + " of " + timeBonus.bonusValue); } GameManager.Instance.UpdateCollectionGoals(piece); } if (particleManager != null) { if (bombedPieces.Contains(piece)) { particleManager.BombFXAt(piece.xIndex, piece.yIndex); } else { particleManager.ClearPieceFXAt(piece.xIndex, piece.yIndex); } } } } }
void ClearPieceAt(List <GamePiece> gamePieces) { foreach (GamePiece piece in gamePieces) { if (piece != null) { ClearPieceAt(piece.xIndex, piece.yIndex); if (m_particleManager != null) { m_particleManager.ClearPieceFXAt(piece.xIndex, piece.yIndex); } } } }
// Clears the gamePieces and plays the proper clear or bomb FX. // Scores the pieces points void ClearPieceAt(List <GamePiece> gamePieces, List <GamePiece> bombedPieces) { foreach (GamePiece piece in gamePieces) { if (piece != null) { ClearPieceAt(piece.xIndex, piece.yIndex); int bonus = 0; if (gamePieces.Count >= 4) { bonus = 20; } piece.ScorePoints(m_scoreMultiplier, bonus); if (m_particleManager != null) { // play bombFX if (bombedPieces.Contains(piece)) { // get bomb component from gameObject // check that bomb component is not null // add bombType to paramaters m_particleManager.BombFXAt(piece.xIndex, piece.yIndex); } else { // play clearFX m_particleManager.ClearPieceFXAt(piece.xIndex, piece.yIndex); } } } } }