コード例 #1
0
 void Reset()
 {
     MusicGameOver.Pause();
     if (GameShop.IS.isMusic)
     {
         MusicBG.Play();
     }
     mCar.GetComponent <Player>().reset();
     mOpponet.GetComponent <Opponent>().Reset();
     mTrack.GetComponent <Track>().ResetGame();
     mGameOver.SetActive(false);
     transform.GetChild(0).gameObject.SetActive(true);
     transform.GetChild(0).GetComponent <Animator> ().SetBool("isOpen", true);
     //if(!GameShop.IS.isRemoveAds)
     //	AdsManager.Instance.ShowInterstitial();
     //Admob.Instance ().loadInterstitial ();
 }
コード例 #2
0
    public void GameOver()
    {
        Debug.Log("GameOver  ~~~~ ");
        MusicBG.Pause();
        if (GameShop.IS.isMusic)
        {
            MusicGameOver.Play();
        }
        //transform.GetChild (1).GetComponent<Animator> ().SetBool ("isOpen", true);
        Score          = 0;
        GameUi.GameScr = GameUi.Scr.GameOverScr;
        //if(GameScr == Scr.GameOverScr)
        {
            //transform.GetChild (0).gameObject.SetActive (false);
            transform.GetChild(0).GetComponent <Animator> ().SetBool("isOpen", false);
            mGameOver.SetActive(true);


            string str = "";

            float val = ((int)(M.mDistance / 10)) / 100f;
            //_TxtDIST.text = val + "" +(((int)(M.mDistance / 10))%100==0?".00":"")+(((int)(M.mDistance / 10))%10==0?"0":"");
            if (((int)(M.mDistance / 10)) % 100 == 0)
            {
                str = val + ".00";
            }
            else if (((int)(M.mDistance / 10)) % 10 == 0)
            {
                str = val + "0";
            }
            else
            {
                str = val + "";
            }


            mGameOver.transform.GetChild(7).GetChild(1).GetChild(0).GetComponent <Text> ().text = str;                                                                  //Distnace
            mGameOver.transform.GetChild(7).GetChild(1).GetChild(1).GetComponent <Text> ().text = M.mCoross + "";                                                       //OverTake
            mGameOver.transform.GetChild(7).GetChild(1).GetChild(2).GetComponent <Text> ().text = M.MAXSPDTIME.ToString("F1") + "";                                     //Over100
            mGameOver.transform.GetChild(7).GetChild(1).GetChild(3).GetComponent <Text> ().text = GameShop.IS.mGameMode != 1 ? "-":M.MAXSPDTIMEOPP.ToString("F1") + ""; //OpposstiteDir


            mGameOver.transform.GetChild(7).GetChild(2).GetChild(0).GetComponent <Text> ().text = ((int)(M.mDistance * .12f)) + "";                                     //Distnace Cash
            mGameOver.transform.GetChild(7).GetChild(2).GetChild(1).GetComponent <Text> ().text = (M.mCoross * 10) + "";                                                //OverTake Cash
            mGameOver.transform.GetChild(7).GetChild(2).GetChild(2).GetComponent <Text> ().text = ((int)(M.MAXSPDTIME * 5f)) + "";                                      //Over100 Cash
            mGameOver.transform.GetChild(7).GetChild(2).GetChild(3).GetComponent <Text> ().text = GameShop.IS.mGameMode != 1 ?"-":(((int)(M.MAXSPDTIMEOPP * 5f)) + ""); //OpposstiteDir Cash

            int total = (int)((M.mDistance * .12f) + (M.mCoross * 10) + (M.MAXSPDTIME * 5f) + (M.MAXSPDTIMEOPP * 5f));

            if (GameShop.IS.isDoubleCash)
            {
                mGameOver.transform.GetChild(7).GetChild(4).GetComponent <Text> ().text = total + " x2";                  //Total
                GameShop.IS.mTotalCash += total * 2;
            }
            else
            {
                mGameOver.transform.GetChild(7).GetChild(4).GetComponent <Text> ().text = total + "";                  //Total
                GameShop.IS.mTotalCash += total;
            }

            mGameOver.transform.GetChild(2).GetChild(0).GetComponent <Text> ().text = GameShop.IS.mTotalCash + "";
            mGameOver.transform.GetChild(3).GetChild(0).GetComponent <Text> ().text = "0";


            GameShop.IS.ModeScore [GameShop.IS.mGameMode] += M.mDistance / 1000;
        }
        GameShop.IS.Save();
        if (!GameShop.IS.isRemoveAds)
        {
            AdsManager.Instance.ShowInterstitial();
            //if (Admob.Instance ().isInterstitialReady ()) {
            //	Admob.Instance ().showInterstitial ();
            //} else {
            //	Admob.Instance ().loadInterstitial ();
            //}
        }
    }