コード例 #1
0
    void ShowHUD(Vector3 position, string message, Action onComplete = null)
    {
        position = _cachedMainCamera.WorldToScreenPoint(position);

        Vector3 begin = position + _addedScoreBeginOffset;
        Vector3 end   = position + _addedScoreEndOffset;

        _addedScoreText.text = message;

        float appearTime    = _addedScoreAppearTime * HUD_APPEAR_RATIO;
        float disappearTime = _addedScoreAppearTime * (1.0f - HUD_APPEAR_RATIO);

        _addedScoreText.LeanCancel();

        LTSeq sequence = LeanTween.sequence();

        sequence.append(() => _addedScoreText.LeanAlpha(0.0f, 1.0f, appearTime));
        sequence.append(_addedScoreText.LeanScale(Vector3.zero, Vector3.one, appearTime).setEaseOutBack());
        sequence.append(HUD_DISAPPEAR_DELAY);
        sequence.append(() => _addedScoreText.LeanAlpha(0.0f, disappearTime));
        sequence.append(_addedScoreText.LeanMove(begin, end, disappearTime));

        sequence.append(() => {
            if (onComplete != null)
            {
                onComplete();
            }
        });
    }
コード例 #2
0
    public static LTDescr LeanAlpha(this TMP_Text text, float from, float to, float time)
    {
        text.alpha = from;

        return(text.LeanAlpha(to, time));
    }