void Update() { //チェックしたの敵の行動をする if (Normal) { NormalMove(); } if (Attacker) { AttackMove(); } if (Shielder) { ShieldMove(); } //ボスが死んでたら死ぬ if (STGBoss.isDead) { //死亡エフェクト Instantiate(EffectDead, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity); //音 SoundMgr.PlaySe("Death", 2); Destroy(this.gameObject); } }
void Update() { if (Input.GetAxis("BottomGreen") == 1) { var menuSelector = GetComponent <MSMM.MenuSelector>(); var index = menuSelector.GetCurrentSelectedIndex(); if (index == 0) { UDCommand.SelectedGameMode.SetMode(0); trans.GetComponent <MSMM.Transition>().LoadScene("UDCMain"); SoundMgr.PlaySe("UDCDecide"); menuSelector.Reset(); } else if (index == 1) { UDCommand.SelectedGameMode.SetMode(1); trans.GetComponent <MSMM.Transition>().LoadScene("UDCMain"); SoundMgr.PlaySe("UDCDecide"); menuSelector.Reset(); } else if (index == 2) { trans.GetComponent <MSMM.Transition>().LoadScene("UDCRanking"); SoundMgr.PlaySe("UDCDecide"); menuSelector.Reset(); } } }
//壁ぶつかったら音 void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Wall") { SoundMgr.PlaySe("Bounce", 4); } }
void Update() { if (active) { if (initialInput) { if (stickNeutral) { if (Input.GetAxis("Horizontal") > 0.5f) { if (selectSEPath != "") { SoundMgr.PlaySe("SelectSE"); } selectedIndex++; if (selectedIndex > (buttons.Length - 1)) { selectedIndex = 0; } } if (Input.GetAxis("Horizontal") < -0.5f) { if (selectSEPath != "") { SoundMgr.PlaySe("SelectSE"); } selectedIndex--; if (selectedIndex < 0) { selectedIndex = buttons.Length - 1; } } stickNeutral = false; } } if (!initialInput) { if ((Input.GetAxis("Horizontal") != 0) || (Input.GetAxis("Vertical") != 0)) { if (selectSEPath != "") { SoundMgr.PlaySe("SelectSE"); } selectedIndex = 0; initialInput = true; stickNeutral = false; } } if (Input.GetAxis("Horizontal") == 0) { stickNeutral = true; } ChangeColorBySelection(selectedIndex); } }
void OnCollisionEnter(Collision collision) { //プレイヤーの弾が当たったら if (collision.gameObject.tag == "Shot") { if (!STGPlayer.isDead && !STGBoss.isDead) { //スコア Score.score += getScore; } //死亡エフェクト Instantiate(EffectDead, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity); //音 SoundMgr.PlaySe("Death", 2); Destroy(this.gameObject); } //壁にぶつかるとスコア減る if (collision.gameObject.tag == "aaa") { if (!STGPlayer.isDead && Score.score > 0) { Score.score -= mScore; } Destroy(this.gameObject); } }
private void CheckConfirmation() { if (Input.GetAxis("BottomGreen") == 1.0f && inputNeutral) { switch (subCanvas.GetComponent <MSMM.MenuSelector>().GetCurrentSelectedIndex()) { case 0: SoundMgr.PlaySe("RecordDecide"); resultString = SymbolToString(firstSymbol) + SymbolToString(secondSymbol) + SymbolToString(thirdSymbol); MSMM.RankingTempData.TempName = resultString; subCanvas.GetComponent <MSMM.MenuSelector>().Reset(); inputNeutral = false; this.gameObject.SetActive(false); break; case 1: SoundMgr.PlaySe("RecordDecide"); subCanvas.SetActive(false); currentLetter--; subCanvas.GetComponent <MSMM.MenuSelector>().Reset(); inputNeutral = false; break; } } }
void Start() { firstSymbol = secondSymbol = thirdSymbol = Symbol.A; currentLetter = 0; subCanvas.SetActive(false); if (useScorePlaceholder) { if (scorePlaceholder == "") { scorePlaceholder = "Score : "; } } if (useNamePlaceholder) { if (namePlaceholder == "") { namePlaceholder = "Name : "; } } SoundMgr.SoundLoadSe("RecordDecide", decideSEPath); SoundMgr.SoundLoadSe("RecordSelect", selectSEPath); SoundMgr.SoundLoadSe("RecordNew", newRecordSEPath); SoundMgr.PlaySe("RecordNew"); }
void OnCollisionEnter(Collision collision) { //弾がぶつかったら if (collision.gameObject.tag == "Shot") { HP -= 1; if (HP <= 0) { isDead = true; //スコア Score.score += getScore; //死亡エフェクト Instantiate(EffectDead, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity); //音 SoundMgr.PlaySe("Death", 2); SoundMgr.PlaySe("ClearFanfare", 7); } //Sliderに値を設定 _Slider.value = HP; } }
private void ResetCurrentCommand() { if (currentCommand >= commandObjects.Count) { var radish = commandObjects[commandObjects.Count - 1].GetComponent <CommandManager>().GetRadish(); if (radish.GetComponent <RectTransform>().anchoredPosition.y >= 150) { currentCommand = 0; correctCommands++; SoundMgr.PlaySe("UDCCorrectList", 4); commandAdded = false; } } if (correctCommands >= 10) { if (correctCommands % 10 == 0) { if (commandObjects.Count < 5 && !commandAdded) { AddCommand(); commandAdded = true; } } } }
//プレイヤーの行動 void Move() { if (isRule) { //もしルール画面なら float rx = Input.GetAxis("Horizontal"); float ry = Input.GetAxis("Vertical"); //移動する向きを求める Vector3 rdirection = new Vector3(rx, ry, 0); //移動する向きとスピードを代入する _rigidbody.velocity = rdirection * speed; //制限をかけた値をプレイヤーの位置とする Vector3 rpos = transform.position; rpos.x = Mathf.Clamp(rpos.x, 4, 8); rpos.y = Mathf.Clamp(rpos.y, 3, 5); transform.position = rpos; } else { //左右移動 float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); //移動する向きを求める Vector3 direction = new Vector3(x, 0, z); //移動する向きとスピードを代入する _rigidbody.velocity = direction * speed; //制限をかけた値をプレイヤーの位置とする Vector3 pos = transform.position; pos.x = Mathf.Clamp(pos.x, -20, 20); pos.z = Mathf.Clamp(pos.z, -20, -10); transform.position = pos; //ショット interval += Time.deltaTime; if (Input.GetAxis("BottomRed") == 1 || Input.GetAxis("BottomGreen") == 1 || Input.GetAxis("BottomBlue") == 1 || Input.GetAxis("BottomYellow") == 1) { if (interval >= intervalTime) { interval = 0.0f; Instantiate(Shot, new Vector3(transform.position.x, transform.position.y, transform.position.z + 2.5f), Quaternion.identity); //音 SoundMgr.PlaySe("Shot", 1); } } } }
public void Move() { switch (enemyState) { //通常 case EnemyState.Normal: active += Time.deltaTime; if (active >= activeTime) { enemyState = EnemyState.Active; } //敵スポーン3s interval += Time.deltaTime; if (interval >= intervalTime) { interval = 0.0f; Instantiate(Enemy, new Vector3(transform.position.x + Random.Range(-spawnRange, spawnRange), transform.position.y - 4.5f, transform.position.z), Quaternion.identity); //音 SoundMgr.PlaySe("Spawn", 5); } break; //時間経過 case EnemyState.Active: //攻撃 interval += Time.deltaTime; if (interval >= 2) { interval = 0.0f; //弾 Instantiate(Shot, new Vector3(transform.position.x - 5, transform.position.y - 4.5f, transform.position.z - 3), Quaternion.identity); //弾 Instantiate(Shot, new Vector3(transform.position.x + 5, transform.position.y - 4.5f, transform.position.z - 3), Quaternion.identity); //音 SoundMgr.PlaySe("Shot", 1); } break; } }
private void UpdateSymbol(ref Symbol sym) { if (inputNeutral) { if (Input.GetAxis("Vertical") >= 0.5f) { SoundMgr.PlaySe("RecordSelect"); if (sym != Symbol.A) { sym--; } else { sym = Symbol.Num9; } inputNeutral = false; } if (Input.GetAxis("Vertical") <= -0.5f) { SoundMgr.PlaySe("RecordSelect"); if (sym != Symbol.Num9) { sym++; } else { sym = Symbol.A; } inputNeutral = false; } if (Input.GetAxis("BottomGreen") == 1.0f) { SoundMgr.PlaySe("RecordDecide"); currentLetter++; inputNeutral = false; } if (Input.GetAxis("BottomRed") == 1.0f) { SoundMgr.PlaySe("RecordDecide"); if (currentLetter != 0) { currentLetter--; } else { firstSymbol = secondSymbol = thirdSymbol = Symbol.A; } inputNeutral = false; } } }
//スタートのカウント IEnumerator Count() { GameStartText.text = "Standby"; GameStartText2.text = "Standby"; yield return(new WaitForSeconds(1.0f)); GameStartText.text = "3"; GameStartText2.text = "3"; SoundMgr.PlaySe("Count_3,2,1", 0); yield return(new WaitForSeconds(1.0f)); GameStartText.text = "2"; GameStartText2.text = "2"; SoundMgr.PlaySe("Count_3,2,1", 0); yield return(new WaitForSeconds(1.0f)); GameStartText.text = "1"; GameStartText2.text = "1"; SoundMgr.PlaySe("Count_3,2,1", 0); yield return(new WaitForSeconds(1.0f)); GameStartText.text = "GAME START"; GameStartText2.text = "GAME START"; SoundMgr.PlayBgm("img_Title2"); yield return(new WaitForSeconds(1.0f)); GameStartText.gameObject.SetActive(false); yield return(new WaitForSeconds(48.0f)); SoundMgr.StopBgm(); yield return(new WaitForSeconds(6.0f)); SoundMgr.PlaySe("BossAlert", 6); yield return(new WaitForSeconds(1.25f)); SoundMgr.PlaySe("BossAlert", 6); yield return(new WaitForSeconds(1.25f)); SoundMgr.PlaySe("BossAlert", 6); yield return(new WaitForSeconds(1.25f)); yield return(new WaitForSeconds(0.0f)); SoundMgr.PlayBgm("Boss00"); yield return(new WaitForSeconds(60.0f)); SoundMgr.PlaySe("TimeOver_A", 8); }
void Update() { if (Input.GetAxis("BottomGreen") == 1) { var menuSelector = GetComponent <MSMM.MenuSelector>(); var index = menuSelector.GetCurrentSelectedIndex(); if (index == 0) { trans.GetComponent <MSMM.Transition>().LoadScene("UDCTitle"); SoundMgr.PlaySe("UDCDecide"); menuSelector.Reset(); } } }
private void Update() { if (Input.GetAxis("BottomGreen") == 1) { var menuSelector = gameObject.GetComponent <MSMM.MenuSelector>(); var index = menuSelector.GetCurrentSelectedIndex(); if (index == 0) { SoundMgr.PlaySe("UDCDecide"); menuSelector.Reset(); manager.StartGame(); gameObject.SetActive(false); } } }
// Update is called once per frame void Update() { if (Input.GetAxis("BottomGreen") == 1) { SoundMgr.PlaySe("Push"); SceneManager.LoadScene("InvaderTitle"); SoundMgr.StopBgm(); } if (Input.GetAxis("BottomRed") == 1) { SoundMgr.PlaySe("Push"); SceneManager.LoadScene("MainTitle"); SoundMgr.StopBgm(); } }
void Update() { if (Input.GetAxis("BottomRed") == 1 || Input.GetAxis("BottomGreen") == 1 || Input.GetAxis("BottomBlue") == 1 || Input.GetAxis("BottomYellow") == 1) { var menuSelector = GetComponent <MSMM.MenuSelector>(); STG.SelectedGameModeSTG.SetMode(0); trans.GetComponent <MSMM.Transition>().LoadScene("InvaderRule"); SoundMgr.PlaySe("Start", 6); menuSelector.Reset(); } if (Input.GetAxis("Option") == 1 && Input.GetAxis("Pause") == 1) { SoundMgr.StopBgm(); } }
void OnCollisionEnter(Collision collision) { //敵、敵の弾、弾に当たったらゲームオーバー if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Shot" || collision.gameObject.tag == "EnemyShot") { isDead = true; //死亡エフェクト Instantiate(EffectDead, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity); //音 SoundMgr.PlaySe("Death", 2); SoundMgr.PlaySe("End", 3); //当たったら消える Destroy(this.gameObject); } }
void Update() { if (!isButtonReleased) { if (Input.GetAxis("Pause") == 0) { isButtonReleased = true; } } if (isButtonReleased) { if (Input.GetAxis("Pause") == 1) { gameObject.SetActive(false); pauseMenu.Reset(); } if (Input.GetAxis("BottomGreen") == 1) { var index = GetComponent <MSMM.MenuSelector>().GetCurrentSelectedIndex(); if (index == 0) { gameObject.SetActive(false); SoundMgr.PlaySe("UDCDecide"); pauseMenu.Reset(); manager.Reset(); trans.GetComponent <MSMM.Transition>().FadeOutIn(); } if (index == 1) { gameObject.SetActive(false); SoundMgr.PlaySe("UDCDecide"); pauseMenu.Reset(); manager.Reset(); trans.GetComponent <MSMM.Transition>().LoadScene("UDCTitle"); } } } }
/// <summary> /// SE再生 /// </summary> public void PlaySe(string seName) { soundMgr.PlaySe(seName, false); }
private void GetInputs() { if (Input.GetAxis("BottomRed") == 1 && !buttonDown[0]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 1); buttonDown[0] = true; } else if (Input.GetAxis("BottomRed") == 0) { buttonDown[0] = false; } if (Input.GetAxis("BottomGreen") == 1 && !buttonDown[1]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 2); buttonDown[1] = true; } else if (Input.GetAxis("BottomGreen") == 0) { buttonDown[1] = false; } if (Input.GetAxis("BottomBlue") == 1 && !buttonDown[2]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 3); buttonDown[2] = true; } else if (Input.GetAxis("BottomBlue") == 0) { buttonDown[2] = false; } if (Input.GetAxis("BottomYellow") == 1 && !buttonDown[3]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 4); buttonDown[3] = true; } else if (Input.GetAxis("BottomYellow") == 0) { buttonDown[3] = false; } if (Input.GetAxis("UpperRed") == 1 && !buttonDown[4]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 1); buttonDown[4] = true; } else if (Input.GetAxis("UpperRed") == 0) { buttonDown[4] = false; } if (Input.GetAxis("UpperGreen") == 1 && !buttonDown[5]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 2); buttonDown[5] = true; } else if (Input.GetAxis("UpperGreen") == 0) { buttonDown[5] = false; } if (Input.GetAxis("UpperBlue") == 1 && !buttonDown[6]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 3); buttonDown[6] = true; } else if (Input.GetAxis("UpperBlue") == 0) { buttonDown[6] = false; } if (Input.GetAxis("UpperYellow") == 1 && !buttonDown[7]) { buttonCount++; popupRand.GetComponent <PopupRandomizer>().Animate(); SoundMgr.PlaySe("SpecialSE", 4); buttonDown[7] = true; } else if (Input.GetAxis("UpperYellow") == 0) { buttonDown[7] = false; } }
void Update() { if (currentTime > 0) { GetInputs(); } if (buttonCount > 0 && !animInit) { gameObject.GetComponentInChildren <Animator>().Play("Wiggle"); animInit = true; textAnim.SetActive(true); popupRand.SetActive(true); } if (currentTime > 0 && buttonCount > 0) { currentTime -= Time.deltaTime; } if (currentTime <= 0) { gameObject.GetComponentInChildren <Animator>().Play("PopupSpecial"); instructText.SetActive(false); resultCanvas.SetActive(true); if (!endSEPlayed) { SoundMgr.PlaySe("UDCGameEnd"); endSEPlayed = true; textAnim.GetComponent <TextAnimation>().Reset(); textAnim.SetActive(false); } SoundMgr.StopBgm(); } if (resultCanvas.activeSelf == true) { var selector = resultCanvas.GetComponent <MSMM.MenuSelector>(); var index = selector.GetCurrentSelectedIndex(); if (index == 0) { if (Input.GetAxis("BottomGreen") == 1) { if (UDCommand.SelectedGameMode.GetMode() == (int)UDCommand.GameMode.Trial) { MSMM.RankingTempData.TempScore += (uint)buttonCount * 1; SoundMgr.PlaySe("UDCDecide"); selector.Reset(); trans.GetComponent <MSMM.Transition>().LoadScene("UDCTrialResult"); MSMM.PlayCounter.AddCount(MSMM.CountType.UDCEnd); } else if (UDCommand.SelectedGameMode.GetMode() == (int)UDCommand.GameMode.Challenge) { MSMM.RankingTempData.TempScore += (uint)buttonCount * 1; SoundMgr.PlaySe("UDCDecide"); selector.Reset(); trans.GetComponent <MSMM.Transition>().LoadScene("UDCChallengeResult"); MSMM.PlayCounter.AddCount(MSMM.CountType.UDCEnd); } } } } }
//赤行動 public void AttackMove() { switch (enemyState) { //通常 case EnemyState.Normal: active += Time.deltaTime; if (active >= activeTime) { enemyState = EnemyState.Active; } //移動 transform.Translate(0, 0, speed); //攻撃 interval += Time.deltaTime; if (interval >= intervalTime) { interval = 0.0f; //弾 Instantiate(Shot, new Vector3(transform.position.x, transform.position.y, transform.position.z - 1), Quaternion.identity); //音 SoundMgr.PlaySe("Shot", 1); } break; //時間経過 case EnemyState.Active: //ジグザグ移動 moveTime += Time.deltaTime; if (moveTime >= 0) { transform.Translate(moveX, 0, speed * 3.0f); } if (moveTime >= 2) { transform.Translate(-moveX * 2, 0, speed * 3.0f); } if (moveTime >= 4) { moveTime = 0.0f; } //攻撃 interval += Time.deltaTime; if (interval >= 4) { interval = 0.0f; //弾 Instantiate(Shot, new Vector3(transform.position.x, transform.position.y, transform.position.z - 1), Quaternion.identity); //音 SoundMgr.PlaySe("Shot", 1); } break; } }