IEnumerator ShowSuccesCO(float delay) { yield return(new WaitForSeconds(.5f)); TheSound.GetInstance().PlaySoundWin(); yield return(new WaitForSeconds(delay - .5f)); canvasSucces.gameObject.SetActive(true); canvasSucces.alpha = 0; canvasSucces.DOFade(1, .4f).SetDelay(0.3f).SetEase(Ease.Linear); }
public static TheSound GetInstance() { if (!instance) { parentObject = GameObject.Find("TheSound"); if (parentObject != null) { instance = parentObject.GetComponent <TheSound>(); } else { Debug.Log("WTF : no instance found for TheSound"); } } return(instance); }
void OnTumble3Complete() { if (isFinish) { Tumble4(); return; } if (tumbles == 0) { Tumble4(); } else { BlockController nextBlock = GameController.levelBlocks[idx, 0]; bool isGameOver = true; if (nextBlock != null) { if (nextBlock.CanTumble()) { isGameOver = false; nextBlock.Tumble1(); Tumble4(); } } if (isGameOver) { GameController.isGameOver = true; TheSound.GetInstance().PlaySoundFail(); Debug.Log("GAME OVER"); TheUI.GetInstance().ShowFailed(.3f); TheUI.GetInstance().FadeDark(1f); } } }
void OnTumble1Complete() { // tumblePivot2.transform.DOLocalRotate(Vector3.right * 90, 0.3f).OnComplete(OnTumble2Complete).SetDelay(0.3f); if (isDummy) { return; } BlockController nextBlock = GetNextBlock(); bool isGameOver = true; bool isWin = false; if (nextBlock != null) { if (nextBlock.CanTumble()) { if (column == GameController.columns - 1) { GameController.dummyBlockLeft.Tumble2(); } else if (column == 0) { GameController.dummyBlockRight.Tumble2(); } isGameOver = false; Tumble2(); nextBlock.Tumble1(); if (nextBlock.row > row) { TheSound.GetInstance().PlaySoundBlockUp(); } else { TheSound.GetInstance().PlaySoundBlock(); } } else { if (nextBlock.canTumble) { int nextColumn; int nextRow; nextBlock.GetNextIdx(out nextColumn, out nextRow); if (nextRow == -99) { Tumble2(); BlockStartController.GetInstance().InitForFinish(nextColumn); nextBlock.gameObject.SetActive(false); TheUI.GetInstance().ShowSucces(2); isWin = true; Debug.Log("WIIIINNN"); } } } } if (isGameOver) { GameController.isGameOver = true; Debug.Log("GAME OVER"); if (!isWin) { TheSound.GetInstance().PlaySoundFail(); TheUI.GetInstance().ShowFailed(2); } TheUI.GetInstance().FadeInDarkDelayed(1.5f); } }