public IEnumerator Skip()
    {
        float timePressed = 0;

        while (true)
        {
            if (Input.GetMouseButton(0))
            {
                timePressed += Time.deltaTime;
            }
            else
            {
                timePressed -= Time.deltaTime * DECREASE_TAX;
            }
            timePressed         = Mathf.Clamp(timePressed, 0, TIME_TO_SKIP);
            skipIcon.fillAmount = timePressed / TIME_TO_SKIP;
            if (timePressed >= TIME_TO_SKIP)
            {
                FindObjectOfType <OpeningAnimation>().Stop();
                yield break;
            }
            if (timePressed > 0)
            {
                skipText.DOFade(1, 0.5f);
            }
            else
            {
                skipText.DOFade(0, 0.5f);
            }
            yield return(null);
        }
    }
示例#2
0
    void Awake()
    {
        text = transform.GetChild(0).GetComponent <TMPro.TMP_Text>();

        transform.DOScale(new Vector3(0.75f, 0.75f, 0.75f), 0.25f).SetEase(Ease.OutElastic)
        .OnComplete(() => transform.DOMoveY(transform.position.y + 1f, 1f).SetEase(Ease.Linear));

        text.DOFade(1, 0.15f).SetEase(Ease.Linear)
        .OnComplete(() => text.DOFade(0, 1f).SetEase(Ease.Linear));
    }
    public void Rotate(bool right)
    {
        string newName;

        if (canRotate)
        {
            canRotate = false;
            startButton.interactable = driverButton.interactable = passengerButton.interactable = false;

            RectTransform rt = transform.GetChild(0).GetComponent <RectTransform>();
            if (right)
            {
                newName = rt.GetChild(2).name;                //, 2f, scrambleMode:ScrambleMode.All);
                if (!TeamManager.IsUnlocked(newName))
                {
                    newName = "???";
                }
                rt.DOAnchorPos(new Vector2(-704f, 0f), 2f).OnComplete(
                    () => {
                    rt.transform.GetChild(0).SetSiblingIndex(rt.transform.childCount - 1);
                    rt.anchoredPosition = new Vector2(-352f, 0f);
                });
            }
            else
            {
                newName = rt.GetChild(0).name;
                if (!TeamManager.IsUnlocked(newName))
                {
                    newName = "???";
                }
                rt.DOAnchorPos(new Vector2(0f, 0f), 2f).OnComplete(() => {
                    rt.transform.GetChild(rt.transform.childCount - 1).SetSiblingIndex(0);
                    rt.anchoredPosition = new Vector2(-352f, 0f);
                }
                                                                   );
            }
            text.DOText(newName, 2f, scrambleMode: ScrambleMode.All);
            text.DOColor((newName == "???"?Color.white:TeamManager.peopleDict[newName].color), 2f);
            description.DOFade(0f, 1f).OnComplete(() => { description.text = (newName == "???"?"???":TeamManager.peopleDict[newName].description.Replace("_", "\n"));
                                                          description.DOFade(1f, 1f).OnComplete(() => { canRotate = true; driverButton.interactable = passengerButton.interactable = newName != "???"; startButton.interactable = TeamManager.HasMain(); }); });
        }
    }
示例#4
0
    internal void SpawnMessage(string messageText)
    {
        TMPro.TMP_Text mes = Instantiate(messagePrefab, transform);
        mes.text = messageText;
        Vector2 targetPos = mes.rectTransform.anchoredPosition + new Vector2(30f, 30f);

        Sequence messageSequence = DOTween.Sequence();

        messageSequence.Append(mes.rectTransform.DOScale(1.5f, 1f))
        .Insert(0.5f, mes.DOFade(0, 0.5f)).OnComplete(delegate
        {
            SimplePool.Despawn(mes.gameObject);
        });
    }