// Update is called once per frame void Update() { // Update Logic if (gameStarted && !gameEnded && !gamePaused) { if (_waitingBubble == null) { CreateBubbleBullet(); } if (_loadedBubble == null && _waitingBubble != null) { if (_waitingBubble.isMoving == false) { LoadBubbleBullet(); } } UpdateFlyingBubbles(); if (needUpdateBullet) { UpdateBulletBubbles(); } UpdateTouchInput(); UpdateArrow(); } // Update Loading and finish else if (_bubbleBoard.isDoneLoading() && !allLoadingDone) { StartCoroutine(StartTheGamePhase1()); } else if (allLoadingDone && startGamePhase1Ended == false) { bool runNextPhase = false; if (Input.GetMouseButtonDown(0)) { Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); if (touchableArea.collider2D == Physics2D.OverlapPoint(pos)) { runNextPhase = true; } } int i = 0; while (i < Input.touchCount) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Vector3 pos = Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position); if (touchableArea.collider2D == Physics2D.OverlapPoint(pos)) { runNextPhase = true; } break; } ++i; } if (runNextPhase) { startGamePhase1Ended = true; StopAllCoroutines(); StartCoroutine(StartTheGamePhase2()); } } // Update execution if (KillList.Count > 0 || DropList.Count > 0) { ExecuteBubbleLists(); } UpdateHUD(); // Key back if (gameStarted && !gameEnded) { if (Input.GetKeyDown(KeyCode.Escape)) { gameSceneController.PauseGame(); } } }