// Update is called once per frame void Update() { var cmbo = Combo; if (Input.GetButtonDown($"{PlayerName}_Fire1")) { elapsedTime = 0.0f; Combo += "A"; } if (Input.GetButtonDown($"{PlayerName}_Fire2")) { elapsedTime = 0.0f; Combo += "B"; } else if (Input.GetButtonDown($"{PlayerName}_Fire3")) { elapsedTime = 0.0f; Combo += "X"; } else if (Input.GetButtonDown($"{PlayerName}_Fire4")) { elapsedTime = 0.0f; Combo += "Y"; } else { elapsedTime += Time.deltaTime; if (elapsedTime > comboInterval) { Combo = ""; } } if ((cmbo != Combo) && (!string.IsNullOrEmpty(Combo))) { OnCombo?.Invoke(this, Combo); } }
public void NotifyCombo(EntityData entity, int combo) { OnCombo?.Invoke(this, entity, combo); }
private IEnumerator FallingDown() { findMatchesStarted = true; // Debug.Log("@@@ Next Move search matches @@@"); THIS.thrivingBlockDestroyed = false; combo = 0; AI.THIS.allowShowTip = false; var it = field.GetItems(); for (var i = 0; i < it.Count; i++) { var item = it[i]; if (item != null) { item.anim.StopPlayback(); } } destLoopIterations = 0; while (true) { destLoopIterations++; checkMatchesAgain = false; var destroyItemsListed = field.GetItems().Where(i => i.destroyNext).ToList(); if (destroyItemsListed.Count > 0) { yield return(new WaitWhileDestroyPipeline(destroyItemsListed, new Delays())); } yield return(new WaitWhileDestroying()); yield return(new WaitWhile(() => StopFall)); yield return(new WaitWhileFall()); yield return(new WaitWhileCollect()); // yield return new WaitWhileFallSide(); var combineCount = CombineManager.GetCombines(field); if ((combineCount.Count <= 0 || !combineCount.SelectMany(i => i.items).Any()) && !field.DestroyingItemsExist() && !field.GetEmptySquares().Any() && !checkMatchesAgain) { break; } if (destLoopIterations > 10) { foreach (var combine in combineCount) { if (combine.items.Any()) { combine.items.NextRandom().NextType = combine.nextType; } } combineCount.SelectMany(i => i.items).ToList().ForEach(i => i.destroyNext = true); } } if (combo > 2 && gameStatus == GameState.Playing) { gratzWords[Random.Range(0, gratzWords.Length)].SetActive(true); combo = 0; OnCombo?.Invoke(); } //CheckItemsPositions(); DragBlocked = false; findMatchesStarted = false; checkMatchesAgain = false; if (gameStatus == GameState.Playing) { StartCoroutine(AI.THIS.CheckPossibleCombines()); } // Debug.Log("<-next turn->"); if (gameStatus == GameState.Playing && !FindObjectsOfType <AnimateItems>().Any()) { OnTurnEnd?.Invoke(); THIS.CheckWinLose(); } }