예제 #1
0
    private void Start()
    {
        GameData gameData = SaveLoadSystem.LoadGameData();

        hasNoAds = gameData.hasNoAds;
        SetCorrectSprite();
    }
예제 #2
0
 public void LoadGameSlots()
 {
     saveSlot1 = SaveLoadSystem.LoadGameData(1);
     saveSlot2 = SaveLoadSystem.LoadGameData(2);
     saveSlot3 = SaveLoadSystem.LoadGameData(3);
     saveSlot4 = SaveLoadSystem.LoadGameData(4);
 }
예제 #3
0
    private void Start()
    {
        GameData gameData = SaveLoadSystem.LoadGameData();

        soundEffectsEnabled = gameData.hasSoundEffects;
        SetCorrectSprite();
    }
예제 #4
0
    public void RestartUI()
    {
        gameData = SaveLoadSystem.LoadGameData();
        HideContinueButton();
        newHighScoreImage.gameObject.SetActive(false);
        SetAllScoresTexts();
        if (!shouldKeepContinueButtonHidden)
        {
            ShowContinueButtonByChance();
        }
        else
        {
            shouldKeepContinueButtonHidden = false;
        }

        EnableRetryButtonTouch();
        EnableMenuButtonTouch();

        if (!gameData.hasNoAds)
        {
            if (interstitialAdScore <= 1.0f)
            {
                LoadIntersitialAd();
            }
        }
    }
예제 #5
0
    private void Start()
    {
        GameData gameData = SaveLoadSystem.LoadGameData();

        musicEnabled = gameData.hasMusic;
        SetCorrectSprite();
    }
예제 #6
0
    public void LoadGameData()
    {
        GameData gameData = SaveLoadSystem.LoadGameData();

        if (gameData != null)
        {
            bestDistance   = gameData.bestDistance;
            collectedCoins = gameData.coin;
            selectedCar    = gameData.selectedCar;

            //Cars Lock/Unlock Data
            lockList = gameData.lockList;
            for (int i = 0; i < lockList.Count; i++)
            {
                carDatas[i].unlocked = lockList[i];
            }
        }
        else
        {
            bestDistance   = 0.0f;
            collectedCoins = 0;
            selectedCar    = CarModel.Polo;

            //Cars Lock/Unlock Data
            for (int i = 0; i < carDatas.Length; i++)
            {
                lockList.Add(carDatas[i].unlocked);
            }

            SaveGameData();
        }
    }
예제 #7
0
 public void GameOver()
 {
     Game.gameManager.gameOverControl = true;
     CarDistance.DistanceCalculater(CarDistanceState.Stop);
     Game.gameManager.CheckBestDistance(CarDistance.GetCurrentDistance());
     bestDistanceText.text = "Best: " + SaveLoadSystem.LoadGameData().bestDistance.ToString("F1");
     gameOverPanel.gameObject.SetActive(true);
 }
예제 #8
0
    private void OnMouseUpAsButton()
    {
        soundEffectsEnabled = !soundEffectsEnabled;
        transform.parent.GetComponent <ButtonClickSoundEffect>().PlayIfPossible();
        SetCorrectSprite();

        GameData gameData = SaveLoadSystem.LoadGameData();

        gameData.hasSoundEffects = soundEffectsEnabled;
        SaveLoadSystem.SaveGameData(gameData);
    }
예제 #9
0
    private void OnMouseUpAsButton()
    {
        musicEnabled = !musicEnabled;
        transform.parent.GetComponent <ButtonClickSoundEffect>().PlayIfPossible();
        SetCorrectSprite();
        BackgroundMusicSource.GetComponent <BackgroundMusic>().PlayIfPossible();

        GameData gameData = SaveLoadSystem.LoadGameData();

        gameData.hasMusic = musicEnabled;
        SaveLoadSystem.SaveGameData(gameData);
    }
예제 #10
0
    void Start()
    {
        GameData gdata = SaveLoadSystem.LoadGameData();

        if (!gdata.hasNoAds)
        {
#if UNITY_ANDROID
            string appId = "ca-app-pub-5709626172947104~8965185682";
#elif UNITY_IPHONE
            string appId = "ca-app-pub-5709626172947104~1880902581";
#else
            string appId = "unexpected_platform";
#endif

            // Initialize the Google Mobile Ads SDK.
            MobileAds.Initialize(appId);

            this.RequestBanner();
        }
    }
예제 #11
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A non-consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, kProductIDNoAds, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The non-consumable item has been successfully purchased, grant this item to the player.
            GameData gameData = SaveLoadSystem.LoadGameData();
            gameData.hasNoAds = true;
            SaveLoadSystem.SaveGameData(gameData);
            GetComponent <MenuUIHandler>().UpdateNoAdsButton();
        }
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }