/// <summary> /// Rotates cover object by given CoverObjectDirection /// </summary> /// <param name="cod"></param> /// <param name="closestIndexes"></param> /// <returns></returns> internal override IEnumerator rotateRoutine(CoverObjectDirection cod, List <int> closestIndexes) { closestIndexes.changeSortingOrder(1); closestIndexes.setParent(transform); closestIndexes.Sort(); for (int i = 0; i < 3; i++) { if (closestIndexes[1] - closestIndexes[0] == 1)//<<if cover object's, two 'vertical aligned' nodes, on the left side { if (cod != CoverObjectDirection.Clockwise) { yield return(StartCoroutine(turnAnim(1f, 0.20f))); closestIndexes.turnIndexesByGivenDirection(1); } else { yield return(StartCoroutine(turnAnim(-1f, 0.20f))); closestIndexes.turnIndexesByGivenDirection(-1); } } else { if (cod != CoverObjectDirection.Clockwise) { yield return(StartCoroutine(turnAnim(1f, 0.20f))); closestIndexes.turnIndexesByGivenDirection(-1); } else { yield return(StartCoroutine(turnAnim(-1f, 0.20f))); closestIndexes.turnIndexesByGivenDirection(1); } } yield return(new WaitForSeconds(0.05f)); //smoothing if (GridSystem.uniqueTriples.checkGroupTriplesHaveSameCountOfColorByGivenCountOfColor(1)) //explosion detected { resetNodesByIndexes(closestIndexes); gameObject.SetActive(false); GameManager.instance.explosionManager.startExplode(GetType(), GridSystem.uniqueTriples.giveEveryGroupThatWillExplode(1)); yield break; } } resetNodesByIndexes(closestIndexes); SwipeLogger.checkForInput(); GameManager.instance.inputSys.enabled = true; }
/// <summary> /// Checks if the game is over. /// </summary> public void gameOverCheck() { if (GridSystem.uniqueTriples.checkGroupTriplesHaveSameCountOfColorByGivenCountOfColor(1)) { explosionManager.currentExplosion.startExplodingTheGivenNodes(GridSystem.uniqueTriples.giveEveryGroupThatWillExplode(1)); } else { if (!bombSys.checkBombsDestroyCounts()) { if (GridSystem.uniqueTriples.IsThereAnyPossibleMoveInGame()) { inputSys.enabled = true; SwipeLogger.checkForInput(); coverObjManager.currentCoverObject.gameObject.SetActive(true); moveSys.incrementMoveCount(); } else { uiManager.openGameOverPanel(); } } } }