void ShowResult() { Time.timeScale = 1f; // 勝った方のキャラのWinモーション再生 GameObject winPlayer = GameObject.FindWithTag(winPlayerTag); winPlayer.transform.Find("UTC_Default").gameObject.GetComponent <Animator>().SetTrigger("Win"); winPlayer.transform.eulerAngles = new Vector3(0, 180, 0); resultCanvas.SetActive(true); if (winPlayerTag == "myPlayer") { // 自分が勝った resultText.text = "You Win!"; ResultManager.result = "WIN"; AudioClip clip = winVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)]; AudioSourceManager.PlayVOICE(clip); AudioSourceManager.audioBGM.loop = false; AudioSourceManager.PlayBGM(endBGMs[0]); } else { // 相手が勝った resultText.text = "You Lose..."; ResultManager.result = "LOSE"; AudioSourceManager.audioBGM.loop = false; AudioSourceManager.PlayBGM(endBGMs[1]); } }
public void VoiceButton() { int rand = Random.Range(0, 6); int chara = PlayerPrefs.GetInt("chara", 0); for (int i = 0; i < SelectCostumeManager.CHARA_MAX; i++) { animators[i].SetTrigger(rand.ToString()); } switch (OfflineCharaSet.GetCharaNum(chara)) { case 0: AudioSourceManager.PlayVOICE(unityVoice[rand]); break; case 1: AudioSourceManager.PlayVOICE(misakiVoice[rand]); break; case 2: AudioSourceManager.PlayVOICE(yukoVoice[rand]); break; } t = 1; }
void BattleStart() { mainCanvas.SetActive(true); AudioSourceManager.PlayVOICE(startVoices[3]); AudioSourceManager.PlayBGM(battleBGM); OfflineManager.isPlaying = true; GameObject.FindWithTag("myPlayer").GetComponent <OfflinePlayerController>().joystick = GameObject.Find("Joystick").GetComponent <Joystick>(); }
public void RightVoicePlay() { if (GameObject.FindWithTag("myPlayer").transform.position.x > 0) { AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)]; AudioSourceManager.PlayVOICE(clip); } else { AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(enemyPlayerPlayerController.chara)]; AudioSourceManager.PlayVOICE(clip); } }
// どちらかのHPが0になったら呼ばれる void BattleEnd(string losePlayerTag) { phase = PHASE.isEnded; AudioSourceManager.audioBGM.Stop(); if (losePlayerTag == "myPlayer") { winPlayerTag = "enemyPlayer"; } else { winPlayerTag = "myPlayer"; } GameObject cam = GameObject.Find("Main Camera"); GameObject myPlayer = GameObject.FindWithTag("myPlayer"); float cam_x; if (winPlayerTag == "myPlayer") { // 自分が勝った cam_x = myPlayer.transform.position.x; AudioClip clip = attackVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)]; AudioSourceManager.PlayVOICE(clip); } else { // 自分が負けた if (myPlayer.transform.rotation.y > 0) { cam_x = myPlayer.transform.position.x - 0.4f; } else { cam_x = myPlayer.transform.position.x + 0.4f; } AudioClip clip = damageVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)]; AudioSourceManager.PlayVOICE(clip); } cam.transform.position = new Vector3(cam_x, 1.5f, -10); cam.transform.eulerAngles = new Vector3(6, 0, 0); cam.GetComponent <Camera>().orthographicSize = 0.6f; Time.timeScale = 0.5f; mainCanvas.SetActive(false); Invoke("ShowResult", 0.8f); }
public void BattleStart() { phase = PHASE.isPlaying; AudioSourceManager.PlayBGM(battleBGM); AudioSourceManager.PlayVOICE(startVoices[3]); mainCanvas.SetActive(true); myPlayerPlayerController.joystick = GameObject.Find("Joystick").GetComponent <Joystick>(); if (GameObject.FindWithTag("myPlayer").transform.position.x < 0) { myHpbar = GameObject.Find("1PHPbar").GetComponent <Image>(); enemyHpbar = GameObject.Find("2PHPbar").GetComponent <Image>(); myHpbarText = GameObject.Find("1PHPtext").GetComponent <Text>(); enemyHpbarText = GameObject.Find("2PHPtext").GetComponent <Text>(); myApbar = GameObject.Find("1PAPbar").GetComponent <Image>(); enemyApbar = GameObject.Find("2PAPbar").GetComponent <Image>(); myApbarText = GameObject.Find("1PAPtext").GetComponent <Text>(); enemyApbarText = GameObject.Find("2PAPtext").GetComponent <Text>(); GameObject.Find("1Pname").GetComponent <Text>().text = myPlayerPlayerController.playerName; GameObject.Find("2Pname").GetComponent <Text>().text = enemyPlayerPlayerController.playerName; } else { myHpbar = GameObject.Find("2PHPbar").GetComponent <Image>(); enemyHpbar = GameObject.Find("1PHPbar").GetComponent <Image>(); myHpbarText = GameObject.Find("2PHPtext").GetComponent <Text>(); enemyHpbarText = GameObject.Find("1PHPtext").GetComponent <Text>(); myApbar = GameObject.Find("2PAPbar").GetComponent <Image>(); enemyApbar = GameObject.Find("1PAPbar").GetComponent <Image>(); myApbarText = GameObject.Find("2PAPtext").GetComponent <Text>(); enemyApbarText = GameObject.Find("1PAPtext").GetComponent <Text>(); GameObject.Find("2Pname").GetComponent <Text>().text = myPlayerPlayerController.playerName; GameObject.Find("1Pname").GetComponent <Text>().text = enemyPlayerPlayerController.playerName; } }
void Start() { if (result != "WIN" && result != "LOSE") { result = "WIN"; } if (result == "WIN") { resultText.text = "You Win!"; } else if (result == "LOSE") { resultText.text = "You Lose..."; } // 端末内保存情報からユーザー情報を抽出 id = PlayerPrefs.GetString("ID"); winCount = PlayerPrefs.GetInt("WinCount"); loseCount = PlayerPrefs.GetInt("LoseCount"); playCount = winCount + loseCount; if (playCount == 0) { winPercent = 0; } else { winPercent = (float)winCount / playCount; } // 更新後のユーザーデータ if (result == "WIN") { newWinCount = winCount + 1; newLoseCount = loseCount; } else if (result == "LOSE") { newLoseCount = loseCount + 1; newWinCount = winCount; } newPlayCount = newWinCount + newLoseCount; newWinPercent = (float)newWinCount / newPlayCount; // キャラのセット int chara = PlayerPrefs.GetInt("chara", 0); int hairColor = PlayerPrefs.GetInt("hair", 0); int eyeColor = PlayerPrefs.GetInt("eye", 0); int costumeColor = PlayerPrefs.GetInt("costume", 0); GameObject charaObj = Instantiate(Resources.Load("CharaPrefabs/chara" + chara) as GameObject); charaObj.transform.position = new Vector3(-0.4f, 0, 0); charaObj.transform.eulerAngles = new Vector3(0, 180, 0); Destroy(charaObj.GetComponent <AnimationEventScript>()); if (chara == 0) { charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_unity" + costumeColor) as Material; } else { charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_school" + costumeColor) as Material; } switch (OfflineCharaSet.GetCharaNum(chara)) { case 0: charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + hairColor) as Material; charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + eyeColor) as Material; break; case 1: charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + hairColor) as Material; charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + eyeColor) as Material; break; case 2: charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + hairColor) as Material; charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + eyeColor) as Material; break; } AudioSourceManager.PlayBGM(bgm); if (result == "WIN") { charaObj.GetComponent <Animator>().SetTrigger("Win"); AudioSourceManager.PlayVOICE(winVoice[OfflineCharaSet.GetCharaNum(chara)]); } else if (result == "LOSE") { charaObj.GetComponent <Animator>().SetTrigger("Lose"); AudioSourceManager.PlayVOICE(loseVoice[OfflineCharaSet.GetCharaNum(chara)]); } }
void RightVoicePlay() { AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(GameObject.FindWithTag("enemyPlayer").GetComponent <OfflineEnemyController>().chara)]; AudioSourceManager.PlayVOICE(clip); }