// Use this for initialization void Start() { startBlock = BlockStartController.GetInstance(); theCamera = gameCamera; InitDummy(); }
public static BlockStartController GetInstance() { if (!instance) { parentObject = GameObject.Find("StarterBlock"); if (parentObject != null) { instance = parentObject.GetComponent <BlockStartController>(); } else { Debug.Log("WTF : no instance found for BlockStartController"); } } return(instance); }
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); } }