private void OnCombo(HashSet <AbstractBlock> aMatchedBlocks) { Console.WriteLine($"Combo! {aMatchedBlocks.Count}"); const float MagicNumber = 0.3f; if (myChainTimer < 0.0f) { myChainTimer = 0.0f; } myChainTimer += (aMatchedBlocks.Count * MagicNumber) / myModifiedGameSpeed; CreateAngryComboBlock(aMatchedBlocks.Count - 1); AbstractBlock rightMostTopMostBlock = aMatchedBlocks.First(); foreach (AbstractBlock block in aMatchedBlocks) { if (block.GetPosition().X > rightMostTopMostBlock.GetPosition().X) { rightMostTopMostBlock = block; } else if (block.GetPosition().X == rightMostTopMostBlock.GetPosition().X) { if (block.GetPosition().Y > rightMostTopMostBlock.GetPosition().Y) { rightMostTopMostBlock = block; } } } Vector2 blockScreenPosition = rightMostTopMostBlock.GetScreenPosition(myOffset, myGridContainer.GetInitialHeight() - 1, myRaisingOffset); Vector2 feedbackOffset = new Vector2(AbstractBlock.GetTileSize(), AbstractBlock.GetTileSize()) / 2f; Vector2 feedbackPosition = blockScreenPosition + feedbackOffset; FeedbackManager.AddFeedback(new ChainComboFeedback("", aMatchedBlocks.Count, feedbackPosition)); }
private void OnChainIncrement(int aChainLength, HashSet <AbstractBlock> aMatchedBlocks) { Console.WriteLine($"Chain {aChainLength}!"); myChainTimer = Math.Max(1.0f, myChainTimer + 1.0f); AbstractBlock rightMostTopMostBlock = aMatchedBlocks.First(); foreach (AbstractBlock block in aMatchedBlocks) { if (block.GetPosition().X > rightMostTopMostBlock.GetPosition().X) { rightMostTopMostBlock = block; } else if (block.GetPosition().X == rightMostTopMostBlock.GetPosition().X) { if (block.GetPosition().Y > rightMostTopMostBlock.GetPosition().Y) { rightMostTopMostBlock = block; } } } Vector2 blockScreenPosition = rightMostTopMostBlock.GetScreenPosition(myOffset, myGridContainer.GetInitialHeight() - 1, myRaisingOffset); Vector2 feedbackOffset = new Vector2(AbstractBlock.GetTileSize(), AbstractBlock.GetTileSize()) / 2f; Vector2 feedbackPosition = blockScreenPosition + feedbackOffset; FeedbackManager.AddFeedback(new ChainComboFeedback("x", aChainLength, feedbackPosition)); }