示例#1
0
 public void TakeArrow()
 {
     if (takeArrow)
     {
         if (TotalData.totalData.blue > 0)
         {
             if (KeepDataOnPlayMode.instance.isSoundOn)
             {
                 GetComponent <AudioSource> ().Play();
             }
             isTookArrowSecondLevel = true;
             takeArrow = false;
             //	StoreInventory.TakeItem("bomb", 1);
             //	int balance = 1;
             //	bombBalance--;
             TotalData.totalData.blue -= 1;
             blueArrowLabel.text       = TotalData.totalData.blue.ToString();
             TotalData.SaveTotalToFile();
             GameObject[] blue = GameObject.FindGameObjectsWithTag("blue");
             for (int j = 0; j < blue.Length; j++)
             {
                 blue [j].GetComponent <BlueTouch> ().SetImprovement(1);
             }
         }
     }
     //	bombLabel.text = bombBalance.ToString();
 }
示例#2
0
    private void HandleShowResult50Coins(ShowResult result)
    {
        Debug.Log("show result");
        switch (result)
        {
        case ShowResult.Finished:
            TotalData.LoadTotalFromFile();
            //		Debug.Log ("The ad was successfully shown.");
            int curValue = TotalData.totalData.totalCoins;
            //		Debug.Log ("total 0: " + curValue);
            TotalData.totalData.totalCoins += 50;
            //		Debug.Log ("total 1: " + TotalData.totalData.totalCoins);
            //	TotalData.totalData.totalCoins += currentLevelData.levelScore;
            //		KeepDataOnPlayMode.instance.reloadedTimes = 0;
            //GameObject.Find ("x2Coins").SetActive (false);
            TotalData.SaveTotalToFile();
            //	GameObject.FindObjectOfType<PowerUps> ().updateCoins (curValue, TotalData.totalData.totalCoins);
            GameObject.FindObjectOfType <BuyCoins> ().updateCoinsAfterAppearing();

            //	GameObject.FindObjectOfType<WinDialog> ().fireCountTo (curValue, TotalData.totalData.totalCoins);

            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }
示例#3
0
 void OffSound()
 {
     soundBttn.GetComponent <Animator> ().SetTrigger("Off");
     TotalData.total.isSoundOn             = false;
     KeepDataOnPlayMode.instance.isSoundOn = false;
     TotalData.SaveTotalToFile();
 }
示例#4
0
    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
        case ShowResult.Finished:
            // Reward for watching ads
            Debug.Log("The ad was successfully shown.");
            TotalData.LoadTotalFromFile();
            mediumScore = TotalData.total.totalScore;
            TotalData.total.totalScore += 20;
            totalScore.GetComponent <CountTo> ().fireCountTo(mediumScore, TotalData.total.totalScore, 1.0f);
            TotalData.SaveTotalToFile();
            ReplayObjects.instance.afterAds();

            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }
示例#5
0
 void OnSound()
 {
     soundBttn.GetComponent <Animator> ().SetTrigger("On");
     soundBttn.GetComponent <Button> ().image.overrideSprite = null;
     TotalData.total.isSoundOn             = true;
     KeepDataOnPlayMode.instance.isSoundOn = true;
     TotalData.SaveTotalToFile();
 }
示例#6
0
 void OffMusic()
 {
     musicBttn.GetComponent <Animator> ().SetTrigger("Off");
     TotalData.total.isMusicOn             = false;
     KeepDataOnPlayMode.instance.isMusicOn = false;
     MusicSound.instance.StopMusic();
     TotalData.SaveTotalToFile();
 }
示例#7
0
 void OnMusic()
 {
     musicBttn.GetComponent <Animator> ().SetTrigger("On");
     musicBttn.GetComponent <Button> ().image.overrideSprite = null;
     MusicSound.instance.PlayMusic();
     TotalData.total.isMusicOn             = true;
     KeepDataOnPlayMode.instance.isMusicOn = true;
     TotalData.SaveTotalToFile();
 }
示例#8
0
 public void TestBuying()
 {
     TotalData.LoadTotalFromFile();
     TotalData.total.noAds = true;
     TotalData.SaveTotalToFile();
     if (ShowBannerAd.instance.bannerView != null)
     {
         ShowBannerAd.instance.bannerView.Hide();
     }
 }
示例#9
0
    public void saveScore()
    {
        TotalData.LoadTotalFromFile();
        TotalData.total.lastScore = score;

        if (score > TotalData.total.bestScore)
        {
            TotalData.total.bestScore = score;
        }
        TotalData.total.totalScore += score;
        TotalData.SaveTotalToFile();
    }
示例#10
0
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
 {
     // A consumable product has been purchased by this user.
     if (String.Equals(args.purchasedProduct.definition.id, Coins100, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));                  //If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
         int curValue = TotalData.totalData.totalCoins;
         TotalData.totalData.totalCoins += 100;
         //	Debug.Log ("100");
         //	GameObject.FindObjectOfType<PowerUps> ().updateCoins (curValue, TotalData.totalData.totalCoins);
         //	GameObject.FindObjectOfType<BuyCoins> ().updateCoins (curValue, TotalData.totalData.totalCoins);
         GameObject.FindObjectOfType <BuyCoins> ().updateCoinsAfterAppearing();
         TotalData.SaveTotalToFile();
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins500, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));                  //If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
         //	Debug.Log ("500");
         int curValue = TotalData.totalData.totalCoins;
         TotalData.totalData.totalCoins += 500;
         //	GameObject.FindObjectOfType<PowerUps> ().updateCoins (curValue, TotalData.totalData.totalCoins);;
         //	GameObject.FindObjectOfType<BuyCoins> ().updateCoins (curValue, TotalData.totalData.totalCoins);
         GameObject.FindObjectOfType <BuyCoins> ().updateCoinsAfterAppearing();
         TotalData.SaveTotalToFile();
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins1000, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));                  //If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
         int curValue = TotalData.totalData.totalCoins;
         TotalData.totalData.totalCoins += 1000;
         //	Debug.Log ("1000");
         //	GameObject.FindObjectOfType<PowerUps> ().updateCoins (curValue, TotalData.totalData.totalCoins);;
         //	GameObject.FindObjectOfType<BuyCoins> ().updateCoins (curValue, TotalData.totalData.totalCoins);
         GameObject.FindObjectOfType <BuyCoins> ().updateCoinsAfterAppearing();
         TotalData.SaveTotalToFile();
     }
     // Or ... a non-consumable product has been purchased by this user.
     else if (String.Equals(args.purchasedProduct.definition.id, NoAdsNonConsumable, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));                  // Or ... a subscription product has been purchased by this user.
         TotalData.totalData.noads = true;
         TotalData.SaveTotalToFile();
     }
     else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
     }                                                                                                                           // 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 wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
     return(PurchaseProcessingResult.Complete);
 }
示例#11
0
//-------------------------------------------------------------------------------------------------------------
//*************************************************************************************************************
//-------------------------------------------------------------------------------------------------------------
    void lineForFirstGame(float farthestLineEndX, float farthestLineEndY)
    {
        GameObject line = ObjectPool.current.GetObject(firstLine);

        line.SetActive(true);
        line.transform.parent = containerObject.transform;

        line.transform.position = new Vector2(farthestLineEndX, farthestLineEndY);
        line.name = firstLine.name;                             //delete "Clone" in the name

        currentLines.Add(line);
        TotalData.total.firstGame = false;
        TotalData.SaveTotalToFile();
    }
示例#12
0
 public void pressedSoundBttn()
 {
     MusicSound.instance.ClickButtonSound();
     TotalData.LoadTotalFromFile();
     if (TotalData.total.isSoundOn)
     {
         OffSound();
     }
     else
     {
         OnSound();
     }
     TotalData.SaveTotalToFile();
 }
示例#13
0
 public void buyLaser()
 {
     if (TotalData.totalData.totalCoins >= 70)
     {
         int curValue = TotalData.totalData.totalCoins;
         TotalData.totalData.totalCoins -= 70;
         TotalData.totalData.laser      += 1;
         TotalData.SaveTotalToFile();
         updateCoinsAfterAppearing();
         //	updateCoins (curValue, TotalData.totalData.totalCoins);
         //	totalCoins.text = TotalData.totalData.totalCoins.ToString();
         GameObject.FindObjectOfType <SlideShowAmount> ().updatePurchases();
     }
 }
示例#14
0
    IEnumerator StartShowLaser()
    {
        yield return(new WaitForSeconds(0.5f));

        if (!TotalData.totalData.fifthLevelArm)
        {
            TotalData.totalData.fifthLevelArm = true;
            TotalData.SaveTotalToFile();
            //			if (!slideShow.GetComponent<SlideShowAmount> ().isTookArrowSecondLevel) {
            if (TotalData.totalData.laser > 0)
            {
                arm.GetComponent <SpriteRenderer> ().enabled = true;
                arm.GetComponent <Animator> ().SetTrigger("Arm");
                isArmAppeared = true;
            }
            //			}
        }
    }
示例#15
0
    void Start()
    {
        arm.transform.position = new Vector2(greenCenter.transform.position.x + 0.9f, greenCenter.transform.position.y - 2.0f);

        if (!TotalData.totalData.fifthLevelArm)
        {
            TotalData.totalData.fifthLevelArm = true;
            TotalData.SaveTotalToFile();
            //			if (!slideShow.GetComponent<SlideShowAmount> ().isTookArrowSecondLevel) {
            if (TotalData.totalData.laser > 0)
            {
                arm.GetComponent <SpriteRenderer> ().enabled = true;
                arm.GetComponent <Animator> ().SetTrigger("Arm");
                isArmAppeared = true;
            }
            //			}
        }
    }
示例#16
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
            {
                // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
                //ScoreManager.score += 100;
                TotalData.LoadTotalFromFile();
                int currentScore = TotalData.total.totalScore;
                TotalData.total.totalScore *= 2;
                ShopScore.instance.checkScore(currentScore, TotalData.total.totalScore, 0.8f);
                TotalData.SaveTotalToFile();
            }
            // Or ... a non-consumable product has been purchased by this user.
            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
            {
                //	TotalData.LoadTotalFromFile ();
                TotalData.total.noAds             = true;
                KeepDataOnPlayMode.instance.noAds = true;
                TotalData.SaveTotalToFile();
                if (ShowBannerAd.instance.bannerView != null)
                {
                    ShowBannerAd.instance.bannerView.Hide();
                }
                // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
            }
            // Or ... a subscription product has been purchased by this user.
            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
            {
                // TODO: The subscription item has been successfully purchased, grant this to the player.
            }
            // 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);
        }
示例#17
0
 void ShowArm()
 {
     if (!showed)
     {
         showed = true;
         if (!TotalData.totalData.seventhLevelArm)
         {
             TotalData.totalData.seventhLevelArm = true;
             TotalData.SaveTotalToFile();
             //			if (!slideShow.GetComponent<SlideShowAmount> ().isTookArrowSecondLevel) {
             if (TotalData.totalData.green > 0)
             {
                 arm.GetComponent <SpriteRenderer> ().enabled = true;
                 arm.GetComponent <Animator> ().SetTrigger("Arm");
                 isArmAppeared = true;
             }
             //			}
         }
     }
 }
示例#18
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("blue"))
     {
         if (!TotalData.totalData.secondLevelArm)
         {
             TotalData.totalData.secondLevelArm = true;
             TotalData.SaveTotalToFile();
             if (!slideShow.GetComponent <SlideShowAmount> ().isTookArrowSecondLevel)
             {
                 if (TotalData.totalData.blue > 0)
                 {
                     arm.GetComponent <SpriteRenderer> ().enabled = true;
                     arm.GetComponent <Animator> ().SetTrigger("Arm");
                     isArmAppeared = true;
                 }
             }
         }
     }
 }
示例#19
0
    void changeActivePlayerUnLocked()
    {
        int previousActiveID = 10000;

        foreach (TotalData.Players player in TotalData.total.players)
        {
            if (player.ID == transform.GetComponent <Player> ().ID)
            {
                player.isLocked = false;
                player.isActive = true;
            }
            else if (player.isActive && player.ID != transform.GetComponent <Player> ().ID)
            {
                player.isActive  = false;
                previousActiveID = player.ID;
            }
        }
        TotalData.SaveTotalToFile();

        transform.GetComponent <Player> ().activatePlayer(previousActiveID);
    }
示例#20
0
    void changeActivePlayer()
    {
        int previousActiveID = 10000;

        foreach (TotalData.Players player in TotalData.total.players)
        {
            if (player.ID == transform.GetComponent <Player> ().ID)
            {
                player.isLocked = false;
                player.isActive = true;
            }
            else if (player.isActive && player.ID != transform.GetComponent <Player> ().ID)
            {
                player.isActive  = false;
                previousActiveID = player.ID;
            }
        }
        TotalData.SaveTotalToFile();
        ShopScore.instance.checkScore(mediumScore, TotalData.total.totalScore, 1.0f);

        transform.GetComponent <Player> ().activatePlayer(previousActiveID);
    }
示例#21
0
 public void CannonLaser()
 {
     //	StoreInventory.TakeItem("armor", 1);
     //	greenArmorBalance--;
     //	greenArmorLabel.text = greenArmorBalance.ToString();
     if (cannonLaser)
     {
         if (TotalData.totalData.laser > 0)
         {
             if (KeepDataOnPlayMode.instance.isSoundOn)
             {
                 GetComponent <AudioSource> ().Play();
             }
             isTookLaserFifthLevel = true;
             panel.GetComponent <Animator> ().SetTrigger("Laser");
             //	StartCoroutine(DeactivateAnimator());
             cannonLaser = false;
             //	OffButton.SetActive(true);
             TotalData.totalData.laser -= 1;
             laserLabel.text            = TotalData.totalData.laser.ToString();
             TotalData.SaveTotalToFile();
             GameObject[] cannons = GameObject.FindGameObjectsWithTag("cannon");
             for (int j = 0; j < cannons.Length; j++)
             {
                 //	Debug.Log(cannons[j].name);
                 //}
                 if (cannons [j].GetComponent <CannonCollision> ())
                 {
                     for (int i = 0; i < cannons [j].GetComponent <CannonCollision> ().laser.Length; i++)
                     {
                         cannons [j].GetComponent <CannonCollision> ().laser [i].SetActive(true);
                         cannons [j].GetComponent <CannonCollision> ().laser [i].GetComponent <Animator> ().SetBool("Active", true);
                     }
                 }
             }
         }
     }
 }
示例#22
0
//	public void TakeBlue(){
    //	StoreInventory.TakeItem("arrow", 1);
    //	bluArrowBalance--;
    //	blueArrowLabel.text = bluArrowBalance.ToString();
//		GameObject.FindObjectOfType<BlueTouch> ().BlueArrow ();
//		GameObject[] blue = GameObject.FindGameObjectsWithTag("blue");
//		for(int j = 0; j < blue.Length; j++){
//			blue[j].GetComponent<BlueTouch>().SetImprovement (1);
//		}
//	}

    public void TakeGreen()
    {
        if (TotalData.totalData.green > 0)
        {
            if (KeepDataOnPlayMode.instance.isSoundOn)
            {
                GetComponent <AudioSource> ().Play();
            }
            //	StoreInventory.TakeItem("armor", 1);
            //	greenArmorBalance--;
            //	greenArmorLabel.text = greenArmorBalance.ToString();
            //	if(takeGreen){
            //		takeGreen = false;
            isTookGreenSeventhLevel    = true;
            TotalData.totalData.green -= 1;
            greenArmorLabel.text       = TotalData.totalData.green.ToString();
            TotalData.SaveTotalToFile();
            GreenTouch.instance.SetImprovement(1);
            //	GameObject.FindObjectOfType<GreenTouch> ().SetImprovement (1);
            //	}
            //	if(GreenTouch.instance.currentImpr == 1 && GreenTouch.instance.currentImpr)
        }
    }
示例#23
0
    // Use this for initialization
    void Start()
    {
        if (TotalData.total.players.Count == 0)
        {
            TotalData.Players tempPlayers = null;

            foreach (Transform obj in transform)
            {
                tempPlayers          = new TotalData.Players();
                tempPlayers.ID       = obj.GetComponent <Player> ().ID;
                tempPlayers.price    = obj.GetComponent <Player> ().price;
                tempPlayers.isLocked = true;
                if (tempPlayers.ID == 1)
                {
                    tempPlayers.isLocked = false;
                    tempPlayers.isActive = true;
                }
                TotalData.total.players.Add(tempPlayers);
            }

            TotalData.SaveTotalToFile();
        }

        if (TotalData.total.players.Count < transform.childCount)
        {
            int totalPlayers = TotalData.total.players.Count;
            int scenePlayers = transform.childCount;

            TotalData.Players tempPlayers = null;
            for (int i = totalPlayers; i < scenePlayers; i++)
            {
                tempPlayers          = new TotalData.Players();
                tempPlayers.ID       = transform.GetChild(i).GetComponent <Player> ().ID;
                tempPlayers.price    = transform.GetChild(i).GetComponent <Player> ().price;
                tempPlayers.isLocked = true;

                TotalData.total.players.Add(tempPlayers);
            }
            TotalData.SaveTotalToFile();
        }
        TotalData.LoadTotalFromFile();
        foreach (TotalData.Players player in TotalData.total.players)
        {
            foreach (Transform obj in transform)
            {
                if (obj.GetComponent <Player> ().ID == player.ID)
                {
                    if (!player.isLocked)
                    {
                        obj.GetComponent <Player> ().isLocked = false;
                    }
                    if (player.isActive)
                    {
                        obj.GetComponent <Player> ().isActive = true;
                    }
                    obj.GetComponent <Player> ().price = player.price;
                    obj.GetComponent <Player> ().setPlayer();
                }
            }
        }
    }
示例#24
0
    /// <summary>
    ///On level complete.
    /// </summary>
    public void OnLevelComplete()
    {
        if (instantiated)
        {
            return;
        }
        instantiated = true;
        KeepDataOnPlayMode.instance.reloadedTimes += 1;
        if (KeepDataOnPlayMode.instance.reloadedTimes > 5)
        {
            KeepDataOnPlayMode.instance.reloadedTimes = 0;
        }
        if (KeepDataOnPlayMode.instance.randomAds == KeepDataOnPlayMode.instance.reloadedTimes)
        {
            KeepDataOnPlayMode.instance.reloadedTimes = 0;
            KeepDataOnPlayMode.instance.randomAds     = KeepDataOnPlayMode.instance.generateIntAds();
            TotalData.LoadTotalFromFile();
            if (!TotalData.totalData.noads)
            {
                ShowAd();
            }
        }
//		Debug.Log("on Level Complete");
        int timerType = 0;

        if (timer != null)
        {
//			Debug.Log("timer");
            timer.Stop();
            timerType = 1;
            CoinsToInt();
        }
        else
        {
//			Debug.Log("timer countdown");
            CoinsToInt();
            timerCountdown.Stop();
            timerType = 2;
        }
        isRunning = false;
        //	Time.timeScale = 0;
        try {
            ///Save the stars level

            DataManager.WorldData currentWorldData = DataManager.FindWorldDataById(World.selectedWorld.ID, DataManager.filterdWorldsData);

            DataManager.LevelData currentLevelData = currentWorldData.FindLevelDataById(TableLevel.selectedLevel.ID);
            TotalData.LoadTotalFromFile();

//			Debug.Log ("currentWorldData: " + currentWorldData);
//			Debug.Log ("currentLevelData: " + currentLevelData.ID);

//			Debug.Log("timerType: " + timerType);
            if (timerType == 1)
            {
//				Debug.Log("first");
                //			currentLevelData.leveltime = (int)timer.timeInSeconds;
                //			Debug.Log ("currentLevelData.leveltime " + currentLevelData.leveltime);
                int currentTime = currentLevelData.leveltime;
                currentLevelData.leveltime = timer.timeInSeconds;
                if (currentTime == 0)
                {
                    //				if(currentLevelData.ID == 1){
                    //					TotalData.totalData.laser = 3;
                    //					TotalData.totalData.green = 3;
                    //					TotalData.totalData.blue = 3;
                    //					TotalData.SaveTotalToFile();
                    //		Debug.Log("done");
                    //				}
                    //			Debug.Log("zero");
                    ///		currentWorldData.Worldtime += timer.timeInSeconds;
                }
                //		currentWorldData.Worldtime += currentTime;
                TotalData.totalData.totalTime += timer.timeInSeconds;

                //		currentWorldData.Worldtime += currentLevelData.leveltime;
                //		currentTotalData.totalTime += currentWorldData.Worldtime;


                if (currentTime > timer.timeInSeconds)
                {
                    //			Debug.Log("less");
                    currentLevelData.leveltime     = timer.timeInSeconds;
                    currentWorldData.Worldtime    += timer.timeInSeconds;
                    TotalData.totalData.totalTime -= (currentTime - timer.timeInSeconds);
                    //			currentWorldData.Worldtime -= (currentTime - timer.timeInSeconds);
                }
                TotalData.SaveTotalToFile();
                //		Debug.Log("currentTime: " + currentTime);
                //		Debug.Log ("currentWorldData.Worldtime: " + currentWorldData.Worldtime);
                currentLevelData.levelScore = coins;
                //		currentWorldData.worldScore += coins;
                //	DataManager.SaveWorldsDataToFile (DataManager.);
                //TotalData.totalData.totalCoins = coins;

//				Debug.Log ("totaldata2: " + TotalData.totalData.totalCoins);
//				Debug.Log("currentTotalData.totalCoins: " + currentTotalData.totalCoins);
                //TotalData.SaveTotalToFile();
//				Debug.Log("gamemanager: " + currentTotalData.totalCoins);
                //			if (currentLevelData.starsLevel < TableLevel.StarsNumber.TWO){
                //				Debug.Log ("good thing");
                //			}
                //Calculate the stars rating
                if (timer.timeInSeconds >= 0 && timer.timeInSeconds <= threeStarsTimePeriod)
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.THREE;
                }
                else if (timer.timeInSeconds > threeStarsTimePeriod && timer.timeInSeconds <= twoStarsTimePeriod)
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.TWO;
                }
                else
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.ONE;
                }
            }
            else if (timerType == 2)
            {
//				Debug.Log("second");
//				Debug.Log ("timerCountdown.timeInSeconds " + timerCountdown.timeInSeconds);
                //	int currentScore = currentLevelData.leveltime;
                //	currentWorldData.Worldtime += currentLevelData.leveltime;
                //	if(currentLevelData.leveltime > timer.timeInSeconds || currentLevelData.leveltime == 0){
                //		currentLevelData.leveltime = timer.timeInSeconds;
                //		currentWorldData.Worldtime -= timer.timeInSeconds;
                //	}
                //	currentLevelData.levelScore = coins;
                //			if (currentLevelData.starsLevel < TableLevel.StarsNumber.TWO){
                //				Debug.Log ("good thing");
                //			}
                //Calculate the stars rating
                //	Debug.Log ("test");
                currentLevelData.levelScore  = coins;
                currentWorldData.worldScore += coins;
                //	TotalData.totalData.totalCoins += coins;
                //	TotalData.SaveTotalToFile();
                if (timerCountdown.timeInSeconds >= 0 && timerCountdown.timeInSeconds <= threeStarsTimePeriod)
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.THREE;
                }
                else if (timerCountdown.timeInSeconds > threeStarsTimePeriod && timerCountdown.timeInSeconds <= twoStarsTimePeriod)
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.TWO;
                }
                else
                {
                    currentLevelData.starsLevel = TableLevel.StarsNumber.ONE;
                }
            }
//			Debug.Log ("test2");
//			Debug.Log ("levelsdata.count " + currentWorldData.levelsData.Count);
            if (currentLevelData.ID + 1 <= currentWorldData.levelsData.Count)
            {
                //				///Unlock the next level
//				Debug.Log ("Unlock next level");
                DataManager.LevelData nextLevelData = currentWorldData.FindLevelDataById(TableLevel.selectedLevel.ID + 1);
//				Debug.Log ("nextleveldata: " + nextLevelData);
                nextLevelData.isLocked = false;
                DataManager.SaveWorldsDataToFile(DataManager.filterdWorldsData);
            }

            if (currentLevelData.ID == currentWorldData.levelsData.Count)
            {
//				Debug.Log ("Last level: " + currentLevelData .ID);
                DataManager.WorldData nextWorldData = DataManager.FindWorldDataById(World.selectedWorld.ID + 1, DataManager.filterdWorldsData);
                nextWorldData.WorldIsLocked = false;
//				Debug.Log ("world " + nextWorldData.ID + nextWorldData.WorldIsLocked);
            }
//			Debug.Log ("test3");
            DataManager.SaveWorldsDataToFile(DataManager.filterdWorldsData);
            TotalData.totalData.totalCoins += coins;
//			Debug.Log ("currentWorldData.Worldtime: " + currentWorldData.Worldtime);
            TotalData.SaveTotalToFile();

            //	for (int ID = 0; ID < 5; ID ++){
            //	int ID = 2;
            //		Debug.Log("World_GameManger " + World.selectedWorld.ID + World.selectedWorld.WorldIsLocked);
            //	}
            BlackArea2.Show();
            WinDialogObj.gameObject.SetActive(true);
            winDialog.starsNumber = currentLevelData.starsLevel;
            winDialog.Show();
        } catch (Exception ex) {
            Debug.Log(ex.Message);
        }
//		Debug.Log ("You win...");
        Time.timeScale = 0;
        //AudioSource.PlayClipAtPoint(finishSFX,Vector3.zero);
    }