示例#1
0
 public void TitleButton()
 {
     Time.timeScale = 1f;
     AdmobGamePlay.StartAd();
     ObjectController.GameOverFlag(false);
     SceneManager.LoadScene("MenuScene");
 }
示例#2
0
    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;
            }
        }
    }
示例#3
0
    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();
            }
        }
    }