private IEnumerator AnimateStarThread()
    {
        contButton.GetComponent <Button>().interactable = false;
        SoundManager.instance.DailyReward();
        yield return(new WaitForSeconds(0.3f));

        gainedStarText.text = PlayerPrefsManager.GetEarnedStar().ToString();
        int tStar         = PlayerPrefsManager.GetDailyProcess();
        int remainingStar = PlayerPrefsManager.GetEarnedStar() - 1;

        for (int i = 0; i < PlayerPrefsManager.GetEarnedStar(); i++)
        {
            Transform star = UnityEngine.Object.Instantiate(starPrefab, starHolder).transform;
            star.localScale    = Vector3.one;
            star.localPosition = Vector3.zero;
            if (tStar + i >= totalKeys)
            {
                StartCoroutine(FugoUtils.CurveMover(shopButton.position, 1.5f, star));
            }
            else
            {
                StartCoroutine(FugoUtils.CurveMover(starDestination.position, 1.5f, star));
            }
            UnityEngine.Object.Destroy(star.gameObject, 1.5f);
            StartCoroutine(DelaySetTexts(1.5f, remainingStar));
            remainingStar--;
            yield return(new WaitForSeconds(0.2f));
        }
        yield return(new WaitForSeconds(1.5f));

        StartCoroutine(FugoUtils.Scaler(Vector3.zero, 0.3f, starHolder));
        PlayerPrefsManager.SetEarnedStar(0);
        MenuController.fromDaily = false;
        float perc = (float)PlayerPrefsManager.GetDailyProcess() / (float)totalKeys;

        if (nextGift + 1 < prizePercentages.Length && perc >= (float)prizePercentages[nextGift + 1] / 100f)
        {
            rewardHolder.GetChild(nextGift + 1).Find("Circle/Box").GetComponent <Image>()
            .sprite = boxesOpened[nextGift + 1];
            prizeCoinAmounts[nextGift] += prizeCoinAmounts[nextGift + 1];
        }
        if (nextGift < prizePercentages.Length && perc >= (float)prizePercentages[nextGift] / 100f)
        {
            StartCoroutine(GiveGift());
            rewardHolder.GetChild(nextGift).Find("Circle/Box").GetComponent <Image>()
            .sprite = boxesOpened[nextGift];
        }
        if (PlayerPrefsManager.GetDailyProcess() == totalKeys)
        {
            PlayerPrefsManager.SetGalleryString(DateTime.Now.Month.ToString());
            SetGallery();
            StartCoroutine(MonthFinishedThread());
            keyText.gameObject.SetActive(value: false);
        }
        yield return(new WaitForSeconds(1f));

        contButton.GetComponent <Button>().interactable = true;
    }
Exemplo n.º 2
0
    private IEnumerator AnimCoinThread(Transform t, Transform destination)
    {
        StartCoroutine(CoinSoundThread());
        StartCoroutine(FugoUtils.CurveMover(destination.position, 1f, t));
        yield return(new WaitForSeconds(0.8f));

        StartCoroutine(FugoUtils.FadeImage(0f, 0.2f, t.GetComponent <Image>()));
        yield return(new WaitForSeconds(1f));

        UnityEngine.Object.Destroy(t.gameObject);
    }
Exemplo n.º 3
0
    private IEnumerator AnimCoinThread(Transform t)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0f, 0.1f)));

        StartCoroutine(FugoUtils.CurveMover(shop.position, 1f, t));
        yield return(new WaitForSeconds(0.8f));

        StartCoroutine(FugoUtils.FadeImage(0f, 0.2f, t.GetComponent <Image>()));
        yield return(new WaitForSeconds(1f));

        UnityEngine.Object.Destroy(t.gameObject);
    }