public static void DisplayComboWidget(GridScript grid, int combo, int blocksCount, long score, BlockDefinition def, Vector2 loc, Vector2[] positions) { if (Instance == null) { return; } var go = Instantiate(Instance.scorePrefab.gameObject, grid.ui.transform, true); go.transform.position = loc + RandomEx.GetVector2(-0.5f, 0.5f, -0.25f, 0.25f); go.transform.localScale = Vector3.one; var comboWidget = go.AddOrGetComponent <ComboTextWidget>(); comboWidget.SetScore(score, def.color); ObjectiveWidget targetWidget = null; var widgets = GetWidgets(grid.player.index); widgets = widgets.Where(w => w != null).ToArray(); // Combo foreach (var w in widgets) { if (w.Objective != null && w.Objective.GetObjectiveType() == ObjectiveStatType.TotalCombos) { AnimateObjectiveUpdate(grid, w, loc); } } // Score foreach (var w in widgets) { if (w.Objective != null && w.Objective.GetObjectiveType() == ObjectiveStatType.Score) { targetWidget = w; } } // 4 combo if (blocksCount == 4) { foreach (var w in widgets) { if (w.Objective != null && w.Objective.GetObjectiveType() == ObjectiveStatType.Total4Combos) { AnimateObjectiveUpdate(grid, w, loc); } } } // 5 combo else if (blocksCount == 5) { foreach (var w in widgets) { if (w.Objective != null && w.Objective.GetObjectiveType() == ObjectiveStatType.Total5Combos) { AnimateObjectiveUpdate(grid, w, loc); } } } // L combos else if (blocksCount > 5) { foreach (var w in widgets) { if (w.Objective != null && w.Objective.GetObjectiveType() == ObjectiveStatType.TotalLCombos) { AnimateObjectiveUpdate(grid, w, loc); } } } if (comboWidget != null) { AnimateComboScoreWidget(comboWidget, targetWidget, combo); } }