void ChangeText() { if (next && tutoTrans < TUTO_TRANS.END) { tutoTrans += 1; next = false; } Collect(); switch (tutoTrans) { case TUTO_TRANS.HOLD_SHIELD: tutoText.text = "盾を持ってみよう"; break; case TUTO_TRANS.SWAP_HAND: tutoText.text = "持ち手を変えてみよう"; break; case TUTO_TRANS.ONLY_ONE_HAND: tutoText.text = "アイテムは\n片手にしか持てない\nトリガーで次へ"; break; case TUTO_TRANS.THROW_BALOON: tutoText.text = "相手は水風船を\n投げてくるよ\nトリガーで次へ"; break; case TUTO_TRANS.PREVENT_BALOON: tutoText.text = "投げてくる水風船を\n弾き返そう"; break; /*case TUTO_TRANS.DURABILITY: * tutoText.text = "盾には耐久度があるよ\nトリガーで次へ"; * break; * * case TUTO_TRANS.THROW_IN: * tutoText.text = "盾が壊れると\nたまに盾が投げ込まれるよ\nトリガーで次へ"; * break; * * case TUTO_TRANS.SWAT_ITEM: * tutoText.text = "盾からバットへ\n持ち替えよう"; * break;*/ case TUTO_TRANS.HOLD_BAT: tutoText.text = "バットを持ってみよう"; break; case TUTO_TRANS.HIT_BACK: tutoText.text = "打ち返してみよう"; break; case TUTO_TRANS.WAHT_DIE: tutoText.text = "3回水風船に当たると\nゲームオーバーです\nトリガーで次へ"; break; case TUTO_TRANS.END: tutoText.text = "チュートリアルは終わり\nゲームを楽しんでね\nトリガーでゲームスタート"; break; default: break; } }
void TutoTrans() { // デバッグ用エンターキーで次の説明へ if (Input.GetKeyDown(KeyCode.Return)) { next = true; } // デバッグ用エンターキーで次の説明へ if (Input.GetKeyDown(KeyCode.Space)) { tutoTrans -= 1; } // チュートリアルをこなしたかの処理 switch (tutoTrans) { case TUTO_TRANS.HOLD_SHIELD: // 盾を持ったか否か if ((rightGrabController.GrabObj != null && rightGrabController.GrabObj.name == "Shield") || (leftGrabController.GrabObj != null && leftGrabController.GrabObj.name == "Shield")) { if (leftGrabController.GrabObj != null) { leftHandObj = true; } else { leftHandObj = false; } // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; } break; case TUTO_TRANS.SWAP_HAND: // 持ち手を変えたかどうか if (leftHandObj) { if (leftGrabController.GrabObj == null && rightGrabController.GrabObj != null && rightGrabController.GrabObj.name == "Shield") { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; } } else { if (rightGrabController.GrabObj == null && leftGrabController.GrabObj != null && leftGrabController.GrabObj.name == "Shield") { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; } } break; case TUTO_TRANS.ONLY_ONE_HAND: // 片手しか持てないことを文章で説明 if (!collectText.activeSelf) { if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; collectText.GetComponent <TextMeshProUGUI>().text = "Next"; } } break; case TUTO_TRANS.THROW_BALOON: // 敵が水風船を投げてくることを説明 if (!enemy.enabled) { enemy.enabled = true; } if (!collectText.activeSelf) { if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; } } break; case TUTO_TRANS.PREVENT_BALOON: if (leftGrabController.GrabObj != null && leftGrabController.GrabObj.GetComponent <GetCollisionObject>().hitObj.name == "WaterBalloon" || (rightGrabController.GrabObj != null && rightGrabController.GrabObj.GetComponent <GetCollisionObject>().hitObj.name == "WaterBalloon")) { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; collectText.GetComponent <TextMeshProUGUI>().text = "Collect"; } break; /* case TUTO_TRANS.DURABILITY: * if (!collectText.activeSelf) * { * if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { * // 次のチュートリアルへ * next = true; * collectFlg = true; * alpha = 1.0f; * collectText.GetComponent<TextMeshProUGUI>().text = "Next"; * } * } * break; * * case TUTO_TRANS.THROW_IN: * if (!collectText.activeSelf) * { * if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) * { * // 次のチュートリアルへ * next = true; * collectFlg = true; * alpha = 1.0f; * } * } * break;*/ case TUTO_TRANS.HOLD_BAT: if ((rightGrabController.GrabObj != null && rightGrabController.GrabObj.name == "But") || (leftGrabController.GrabObj != null && leftGrabController.GrabObj.name == "But")) { if (leftGrabController.GrabObj != null) { leftHandObj = true; } else { leftHandObj = false; } // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; collectText.GetComponent <TextMeshProUGUI>().text = "Collect"; } break; case TUTO_TRANS.HIT_BACK: if ((leftGrabController.GrabObj != null && leftGrabController.GrabObj.GetComponent <GetCollisionObject>().hitObj.name == "WaterBalloon") || (rightGrabController.GrabObj != null && rightGrabController.GrabObj.GetComponent <GetCollisionObject>().hitObj.name == "WaterBalloon")) { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; } break; case TUTO_TRANS.WAHT_DIE: if (!collectText.activeSelf) { if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { // 次のチュートリアルへ next = true; collectFlg = true; alpha = 1.0f; collectText.GetComponent <TextMeshProUGUI>().text = "Next"; } } break; case TUTO_TRANS.END: if (!collectText.activeSelf) { if (rightController.GetPress(SteamVR_Controller.ButtonMask.Trigger) || leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { // Tutorialを終了して次の処理へ } } break; default: break; } }