void Update() { if (gameController.isStep1Finished && !isColliderOn) { this.gameObject.GetComponent <CapsuleCollider>().enabled = true; startPosition = this.transform.position; isColliderOn = true; distance = Vector3.Distance(startPosition, balloonPosition.transform.position); } if (isSelected && moveFlag) { float coverDistance = (Time.time - startTime) * speed; float scale = coverDistance / distance; this.transform.position = Vector3.Lerp(startPosition, balloonPosition.transform.position, scale); cam.transform.position = Vector3.Lerp(new Vector3(0, 0, -10f), new Vector3(0, 5.5f, -10f), scale); //pump.transform.position = Vector3.Lerp(startPumpPosition, endPumpPoint.transform.position, scale); if (scale > 1f) { moveFlag = false; gameController.isStep2Finished = true; startPipe[gameController.selectedBalloonNumber].SetActive(true); instruction.SetHandInstruction(2); } } }
IEnumerator Step1Transform() { StartCoroutine(FadeAndMove(upPart, time, upPartDistance, count, true)); yield return(new WaitForSeconds(1f)); foreach (GameObject balloon in balloons) { StartCoroutine(FadeAndMove(balloon, time, balloonDistance, count, false)); } yield return(new WaitForSeconds(time)); isStep1Finished = true; instruction.SetHandInstruction(1); }
public void OnButtonDown() { if (textfield[gameController.selectedBalloonNumber].GetComponent <TMP_Text>().text != "") { tweBackward = keyboard.transform.DOLocalMoveY(4.3f, movingTime); tweBackward.PlayForward(); //gameController.pencilButton[gameController.selectedBalloonNumber].GetComponent<SpriteRenderer>().color = new Color (1f,1f,1f,1f); //gameController.pencilButton[gameController.selectedBalloonNumber].GetComponent<Collider>().enabled = true; gameController.isEdited = true; gameController.weight[gameController.selectedBalloonNumber].GetComponent <BoxCollider>().enabled = true; if (!isInstructionSet) { instruction.SetHandInstruction(4); isInstructionSet = true; } } }