public void UnlockConditionText() { Text unlockText = GameObject.Find("unlockConditionText").GetComponent <Text>(); if (cars[carNumber].tag == "Locked") { RewardCar rewards = new RewardCar(); rewards = rewards.LoadRewards(); justStopModeButton.interactable = false; timeAttackModeButton.interactable = false; switch (carNumber) { case 1: unlockText.text = "アンロック条件:ゲームを" + MenuDirector.miniCarUnlockQuota + "回遊ぶ\n" + "残り:" + (MenuDirector.miniCarUnlockQuota - rewards.miniCarKey) + "回"; break; case 2: unlockText.text = "アンロック条件:ジャストストップモードで\n+-30m以内に停車を" + MenuDirector.buggyUnlockQuota + "回達成する\n" + "残り:" + (MenuDirector.buggyUnlockQuota - rewards.buggyKey) + "回"; break; case 3: unlockText.text = "アンロック条件:ジャストストップモードで\n+-15m以内に停車を" + MenuDirector.truckUnlockQuota + "回達成する\n" + "残り:" + (MenuDirector.truckUnlockQuota - rewards.truckKey) + "回"; break; case 4: unlockText.text = "アンロック条件:タイムアタックモードで\n600m以上の走行を" + MenuDirector.sportsCarUnlockQuota + "回達成する\n" + "残り:" + (MenuDirector.sportsCarUnlockQuota - rewards.sportsCarKey) + "回"; break; case 5: unlockText.text = "アンロック条件:タイムアタックモードで\n800m以上の走行を" + MenuDirector.f1CarUnlockQuota + "回達成する\n" + "残り:" + (MenuDirector.f1CarUnlockQuota - rewards.f1CarKey) + "回"; break; } } else { unlockText.text = ""; justStopModeButton.interactable = true; timeAttackModeButton.interactable = true; } }
public void CarUnlockCheck() { RewardCar rewards = new RewardCar(); rewards = rewards.LoadRewards(); if (rewards.sportsCarKey == MenuDirector.sportsCarUnlockQuota || rewards.miniCarKey == MenuDirector.miniCarUnlockQuota || rewards.buggyKey == MenuDirector.buggyUnlockQuota || rewards.truckKey == MenuDirector.truckUnlockQuota || rewards.f1CarKey == MenuDirector.f1CarUnlockQuota) { retryButton.GetComponent <Button>().interactable = false; titleButton.GetComponent <Button>().interactable = false; StartCoroutine(DelayMethod(2.0f, () => { carunlockImage.SetActive(true); carUnlockSound.Play(); })); } }
public void RewardLock() { RewardCar rewards = new RewardCar(); rewards = rewards.LoadRewards();; if (rewards.miniCarKey < MenuDirector.miniCarUnlockQuota) { Renderer[] carColor = cars[1].GetComponentsInChildren <Renderer>(); int i; for (i = 0; i < carColor.Length; i++) { carColor[i].material.color = Color.black; } } else { cars[1].tag = "Unlocked"; } if (rewards.buggyKey < MenuDirector.buggyUnlockQuota) { Renderer[] carColor = cars[2].GetComponentsInChildren <Renderer>(); int i; for (i = 0; i < carColor.Length; i++) { carColor[i].material.color = Color.black; } } else { cars[2].tag = "Unlocked"; } if (rewards.truckKey < MenuDirector.truckUnlockQuota) { Renderer[] carColor = cars[3].GetComponentsInChildren <Renderer>(); int i; for (i = 0; i < carColor.Length; i++) { carColor[i].material.color = Color.black; } } else { cars[3].tag = "Unlocked"; } if (rewards.sportsCarKey < MenuDirector.sportsCarUnlockQuota) { Renderer[] carColor = cars[4].GetComponentsInChildren <Renderer>(); int i; for (i = 0; i < carColor.Length; i++) { carColor[i].material.color = Color.black; } } else { cars[4].tag = "Unlocked"; } if (rewards.f1CarKey < MenuDirector.f1CarUnlockQuota) { Renderer[] carColor = cars[5].GetComponentsInChildren <Renderer>(); int i; for (i = 0; i < carColor.Length; i++) { carColor[i].material.color = Color.black; } } else { cars[5].tag = "Unlocked"; } }
public void TimeAttackMode() { limit -= Time.deltaTime; timeLimit.GetComponent <Text>().text = "残り:" + limit.ToString("F2") + "秒"; if (limit <= 0) { isGameOver = true; } if (!isGameOver) { length = this.car.transform.GetChild(0).position.x - startPos; this.distance.GetComponent <Text>().text = "走行距離:" + length.ToString("F2") + "m"; } else { if (playOnce) { timeLimit.SetActive(false); CameraController.GameOverFlag(); ObjectController.GameOverFlag(true); BackgroundController.GameOverFlag(); CarController.GameOverFlag(); pauseButton.SetActive(false); retryButton.SetActive(true); titleButton.SetActive(true); this.distance.GetComponent <Text>().text = "記録:" + length.ToString("F2") + "m"; Record TAMrecords = new Record(); TAMrecords = TAMrecords.LoadRecords(); if (TAMrecords.TAMfirst < length) { TAMrecords.TAMthird = TAMrecords.TAMsecond; TAMrecords.TAMsecond = TAMrecords.TAMfirst; TAMrecords.TAMfirst = length; TAMrecords.SaveRecords(TAMrecords); } else if (TAMrecords.TAMsecond < length) { TAMrecords.TAMthird = TAMrecords.TAMsecond; TAMrecords.TAMsecond = length; TAMrecords.SaveRecords(TAMrecords); } else if (TAMrecords.TAMthird > length) { TAMrecords.TAMthird = length; TAMrecords.SaveRecords(TAMrecords); } RewardCar rewards = new RewardCar(); rewards = rewards.LoadRewards(); if (rewards.miniCarKey <= MenuDirector.miniCarUnlockQuota) { rewards.miniCarKey++; } if (rewards.sportsCarKey == MenuDirector.sportsCarUnlockQuota) { rewards.sportsCarKey++; } if (rewards.f1CarKey == MenuDirector.f1CarUnlockQuota) { rewards.f1CarKey++; } if (600 < length) { if (rewards.sportsCarKey <= MenuDirector.sportsCarUnlockQuota) { rewards.sportsCarKey++; } if (800 < length) { if (rewards.f1CarKey <= MenuDirector.f1CarUnlockQuota) { rewards.f1CarKey++; } } } rewards.SaveRewards(rewards); anim.Play(); apploudSound.Play(); CarUnlockCheck(); playOnce = false; } } }
public void JustStopMode() { if (length < -200) { isGameOver = true; } if (!isGameOver) { length = stopLine.transform.position.x - this.car.transform.GetChild(0).position.x; this.distance.GetComponent <Text>().text = "目標まで:" + length.ToString("F2") + "m"; } else { if (playOnce) { CameraController.GameOverFlag(); ObjectController.GameOverFlag(true); BackgroundController.GameOverFlag(); CarController.GameOverFlag(); retryButton.SetActive(true); titleButton.SetActive(true); pauseButton.SetActive(false); this.distance.GetComponent <Text>().text = "記録:" + length.ToString("F2") + "m"; anim.Play(); apploudSound.Play(); playOnce = false; Record JSMrecords = new Record(); JSMrecords = JSMrecords.LoadRecords(); if (Math.Abs(JSMrecords.JSMfirst) > Math.Abs(length)) { JSMrecords.JSMthird = JSMrecords.JSMsecond; JSMrecords.JSMsecond = JSMrecords.JSMfirst; JSMrecords.JSMfirst = length; JSMrecords.SaveRecords(JSMrecords); } else if (Math.Abs(JSMrecords.JSMsecond) > Math.Abs(length)) { JSMrecords.JSMthird = JSMrecords.JSMsecond; JSMrecords.JSMsecond = length; JSMrecords.SaveRecords(JSMrecords); } else if (Math.Abs(JSMrecords.JSMthird) > Math.Abs(length)) { JSMrecords.JSMthird = length; JSMrecords.SaveRecords(JSMrecords); } RewardCar rewards = new RewardCar(); rewards = rewards.LoadRewards(); rewards.miniCarKey++; if (rewards.miniCarKey > MenuDirector.miniCarUnlockQuota) { rewards.miniCarKey = 6; } if (rewards.buggyKey == MenuDirector.buggyUnlockQuota) { rewards.buggyKey++; } if (rewards.truckKey == MenuDirector.truckUnlockQuota) { rewards.truckKey++; } if (30 > Math.Abs(length)) { if (rewards.buggyKey <= MenuDirector.buggyUnlockQuota) { rewards.buggyKey++; } if (15 > Math.Abs(length)) { if (rewards.truckKey <= MenuDirector.truckUnlockQuota) { rewards.truckKey++; } } } rewards.SaveRewards(rewards); CarUnlockCheck(); } } }