// Update is called once per frame void Update() { TimerController timetext1 = Timetext.GetComponent <TimerController>(); //ボールが画面外に出た場合 if (this.transform.position.z < this.visiblePosZ) { this.gameover = true; if (timetext1.totaltime > 0 && timetext1.timeup == false) { //GameoverTextにゲームオーバを表示 this.gameoverText.GetComponent <Text>().text = "Game Over"; //フリッパー付属スクリプト呼び出しと変数変更PC FripperController fripper1 = this.Fripper1.GetComponent <FripperController>(); fripper1.gameplay = false; FripperController fripper2 = this.Fripper2.GetComponent <FripperController>(); fripper2.gameplay = false; //フリッパー付属スクリプト呼び出しと変数変更Android TouchSystem fripper11 = this.Fripper1.GetComponent <TouchSystem>(); fripper11.gameplay = false; TouchSystem fripper22 = this.Fripper2.GetComponent <TouchSystem>(); fripper22.gameplay = false; //retry CanvasController.SetActive("RetryButton", true); } } }
// Use this for initialization void Start() { GameObject tmpTObj = GameObject.Find("HattenKadai_DebugText") as GameObject; if (tmpTObj) { mDebugText = tmpTObj.GetComponent <UnityEngine.UI.Text>() as UnityEngine.UI.Text; } GameObject tmpObj = null; tmpObj = GameObject.Find("RightFripper") as GameObject; if (tmpObj) { mRFScript = tmpObj.GetComponent <FripperController>() as FripperController; //FripperControllerスクリプトの取得 } tmpObj = GameObject.Find("LeftFripper") as GameObject; if (tmpObj) { mLFScript = tmpObj.GetComponent <FripperController>() as FripperController; //FripperControllerスクリプトの取得 } //タッチ入力に対応しているかチェック if (Input.touchSupported == true) { mMessage = "タッチパネルサポート"; Input.multiTouchEnabled = true; } Input.multiTouchEnabled = true; mDebugText.text = mMessage; }
// Update is called once per frame void Update() { int count = Input.touchCount; for (int i = 0; i < count; i++) { Touch touch = Input.GetTouch(i); Vector2 Vec = new Vector2(touch.position.x, Screen.height - touch.position.y); if (touch.phase == TouchPhase.Began) { //右側 if (Vec.x <= rect.width / 2 && Vec.y >= rect.yMin) { FripperController leftfc = leftfripper.GetComponent <FripperController> (); leftfc.SetAngle(leftfc.flickAngle); } //左側 if (Vec.x >= rect.width / 2 && Vec.y >= rect.yMin) { FripperController rightfc = rightfripper.GetComponent <FripperController> (); rightfc.SetAngle(rightfc.flickAngle); } if (Input.touchCount > 1) { } } if (touch.phase == TouchPhase.Ended) { FripperController leftfc = leftfripper.GetComponent <FripperController> (); leftfc.SetAngle(leftfc.defaultAngle); FripperController rightfc = rightfripper.GetComponent <FripperController> (); rightfc.SetAngle(rightfc.defaultAngle); } } }
void Update() { // 毎フレーム毎に残り時間を減らしてく this.totaltime -= Time.deltaTime; //ボールコントローラー呼び出し BallCountroller ballcon = this.Ball.GetComponent <BallCountroller>(); if (this.totaltime < 0) { if (ballcon.gameover == false) { this.timeup = true; this.gameoverText.GetComponent <Text>().text = "Game Clear"; //フリッパー付属スクリプト呼び出しと変数変更PC FripperController fripper1 = this.Fripper1.GetComponent <FripperController>(); fripper1.gameplay = false; FripperController fripper2 = this.Fripper2.GetComponent <FripperController>(); fripper2.gameplay = false; //フリッパー付属スクリプト呼び出しと変数変更Android TouchSystem fripper11 = this.Fripper1.GetComponent <TouchSystem>(); fripper11.gameplay = false; TouchSystem fripper22 = this.Fripper2.GetComponent <TouchSystem>(); fripper22.gameplay = false; //retry CanvasController.SetActive("RetryButton", true); } } else { // timeを文字列に変換したものをテキストに表示する minutes = (int)totaltime / 60; seconds = (int)totaltime - minutes * 60; this.TimeText.GetComponent <Text>().text = this.minutes.ToString("00") + ":" + this.seconds.ToString("00"); } }