private YieldInstruction ShowMessage(string text) { const float showDuration = 0.9f; const float sustain = 2.3f; const float hideDuration = 0.4f; const float idleScale = 0.8f; _message.text = text; IEnumerator ShowMessageRoutine() { _message.gameObject.SetActive(true); _message.color = _message.color.Change(a: 0); _message.transform.localScale = Vector3.one * idleScale; yield return(DOTween.Sequence() .Join(_message.transform.DOScale(1, showDuration)) .Join(_message.DOFade(1, showDuration)) .AppendInterval(sustain) .Append(_message.transform.DOScale(idleScale, hideDuration)) .Join(_message.DOFade(0, hideDuration)) .WaitForCompletion()); _message.gameObject.SetActive(false); } return(StartCoroutine(ShowMessageRoutine())); }
public IEnumerator StartCountdown(int countdownValue) { counting = true; currCountdownValue = countdownValue; GameController.Instance.IncreaseTempo(0.025f); timer_text.DOFade(1, 0.5f); while (currCountdownValue >= 0) { yield return(new WaitForSeconds(1.0f)); currCountdownValue--; timer_text.transform.DOShakeScale(0.1F, 0.5F, 2, 0, true); if (currCountdownValue == 3) { timer_text.DOColor(Color.red, 0.5f); } if (currCountdownValue == 0) { timer_text.DOFade(0.0f, 0.75f); } } StartCoroutine(StopCountdown()); timer_text.DOColor(Color.white, 0.1f); counting = false; }
public void WriteInConsole(string textToWrite) { consoleText.DOFade(1, 0); consoleText.DOFade(0, 4f); consoleText.text = textToWrite; }
private IEnumerator DisplaySuccessText() { successText.DOFade(1f, 1); yield return(new WaitForSeconds(2)); successText.DOFade(0f, 1); }
private void Awake() { _image = GetComponent <Image>(); _image.DOFade(0.0f, 0.0f); _text.DOFade(0.0f, 0.0f); _textName.DOFade(0.0f, 0.0f); _imageChild.DOFade(0.0f, 0.0f); }
void SwitchText(float transitionTime, string newText) { textChanging = true; _textBox.DOFade(0, transitionTime); // fade current text out _textBox.text = newText; _textBox.DOFade(255, transitionTime); // fade new text in textChanging = false; }
public Sequence CoverIcon(bool cover) { var seq = DOTween.Sequence(); seq.Join(blocker.DOFade(cover ? 1 : 0, duration)); seq.Join(label.DOFade(cover ? 0 : 1, duration)); return(seq); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { anim.DOText(fullName, 1f, scrambleMode: ScrambleMode.All); anim.DOFade(1f, 0.25f); activated(true); } }
private IEnumerator Sequence(Promise promise) { _introductionCanvas.DOFade(0, 0); _welcomeText.DOFade(0, 0); _tutorialCanvas.DOFade(0, 0); _introductionCanvas.DOFade(1, .45f); var textsToShow = _welcomeBackTexts; if (PlayerPrefs.GetInt(PlayerPrefKey.IntroSeen, 0) == 0) { textsToShow = _introTexts; PlayerPrefs.SetInt(PlayerPrefKey.IntroSeen, 1); } foreach (var introText in textsToShow) { yield return(new WaitForSeconds(.45f)); _welcomeText.text = introText; _welcomeText.DOFade(1f, .65f); yield return(new WaitForSeconds(1f + .08f * introText.Length)); _welcomeText.DOFade(0, .85f); yield return(new WaitForSeconds(1f)); } if (PlayerPrefs.GetInt(PlayerPrefKey.TutorialSeen, 0) == 0) { _figure.DOFade(0, .45f); yield return(new WaitForSeconds(1f)); _tutorialCanvas.DOFade(1, .45f); yield return(new WaitForSeconds(6f)); _tutorialCanvas.DOFade(0, .35f); PlayerPrefs.SetInt(PlayerPrefKey.TutorialSeen, 1); } yield return(new WaitForSeconds(.15f)); _introductionCanvas.DOFade(0, .85f); yield return(new WaitForSeconds(1f)); _curtainAnimator.SetTrigger("Open"); yield return(new WaitForSeconds(1.5f)); promise.Resolve(); }
public void InformationText(string s) { if (_isDisplaying) { return; } _isDisplaying = true; _informationText.text = s; _informationText.DOFade(1.0f, _textFadeTime).OnComplete(FadeTextOut); }
private IEnumerator ShowCycleMessage(DayTime cycle) { cycleMessage.alpha = 0f; cycleMessage.text = GetCycleMessage(cycle); yield return(cycleMessage.DOFade(1f, 0.5f)); yield return(new WaitForSeconds(5f)); yield return(cycleMessage.DOFade(0f, 0.5f)); }
void AnimateNoMoreCoinsText() { // Complete animations (if it's running) noEnoughCoinsText.transform.DOComplete(); noEnoughCoinsText.DOComplete(); noEnoughCoinsText.transform.DOShakePosition(3f, new Vector3(5f, 0f, 0f), 10, 0); noEnoughCoinsText.DOFade(1f, 3f).From(0f).OnComplete(() => { noEnoughCoinsText.DOFade(0f, 1f); }); }
public void Alert(string alert, float alertTime = ALERT_TIME) { AudioManager.instance.Play("Blip"); m_alertText.text = alert; m_alertText.DOKill(true); m_alertText.transform.DOKill(true); m_alertText.rectTransform.DOKill(true); m_alertText.DOFade(1, alertTime / 2).OnComplete(() => m_alertText.DOFade(0, alertTime / 2)); m_alertText.rectTransform.DOAnchorPosY(100, alertTime).OnComplete(() => m_alertText.rectTransform.anchoredPosition = Vector2.zero); }
public void Play() { var canvasGroup = GetComponent <CanvasGroup>(); canvasGroup.DOFade(1, 0); canvasGroup.interactable = true; canvasGroup.blocksRaycasts = true; bigText.DOFade(0, 0); text.DOFade(0, 0); StartCoroutine(Animation()); FindObjectOfType <SkipButton>().StartSkip(); }
public void GoodFeedback(Action callback) { text.DOFade(1f, 0.25f).OnComplete( () => { text.DOFade(0f, 0.5f).OnComplete( () => { callback(); text.color = startColor; }); }); }
public void ToggleRadio() { on = !on; if (on) { radioDisplay.enabled = on; radioDisplay.DOFade(1f, 0.25f); } else { radioDisplay.DOFade(0f, 0.25f).OnComplete(() => { radioDisplay.enabled = false; }); } source.DOFade(on?startVolume:0f, 0.25f); }
private void Awake() { _curtainCanvas.DOFade(0, 0); _text.DOFade(0, 0); _gameOverView.gameObject.SetActive(false); }
public void ShowTimer(bool boolean, bool timeGoesOn, float fadeTime) { if (boolean) { timerText.DOFade(1.0f, fadeTime); } else { timerText.DOFade(0.0f, fadeTime); if (timeGoesOn) { SetPauseTimer(true); } } }
void Start() { Text.alpha = 0f; Background.color = Color.white; Foreground.color = new Color(1f, 1f, 1f, 0f); var anim = DOTween.Sequence() .AppendInterval(1f) .Append(Foreground.DOFade(1f, 1f)) .Insert(0.3f, Text.DOFade(1f, 1f)) .AppendCallback(() => Background.color = new Color(1f, 1f, 1f, 0f)) .AppendInterval(2f) .Append(Text.DOFade(0f, 0.5f)) .Insert(3.2f, Background.DOFade(0f, 0.5f)); anim.onComplete += () => gameObject.SetActive(false); }
public void SetIncreaseResourceText(int inceaseAmount) { string increaseText = ""; if (inceaseAmount > 0) { increaseText += "+"; Color c = Color.green; c.a = 1; text.color = c; } else { Color c = Color.red; c.a = 1; text.color = c; } increaseText += inceaseAmount.ToString(); text.text = increaseText; transform.position = startPos; transform.DOLocalMoveY(50, 1); text.DOFade(0, 1); }
public void Show(TweenCallback onComplete) { _gameOverText.gameObject.SetActive(true); _overlay.DOFade(1f, 2f); _gameOverText.DOFade(1f, 2f).OnComplete(() => { Timing.CallDelayed(2f, () => { _gameOverText.DOFade(0, 2f).OnComplete(() => { _gameOverText.gameObject.SetActive(false); _logo.DOFade(1f, 1f).OnComplete(onComplete); }); }); }); }
// Start is called before the first frame update // Update is called once per frame void Update() { if (flowchart.GetBooleanVariable("showMoral")) { moralBG.DOFade(1, 5f); if (moralBG.color.a >= 0.9) { moralText.gameObject.SetActive(true); moralText.text = "Ending " + flowchart.GetIntegerVariable("ending") + ":\n" + flowchart.GetStringVariable("moral"); moralText.DOFade(1, 8f); restartButton.SetActive(true); } Image[] buttonImages = restartButton.GetComponentsInChildren <Image>(); Text buttonText = restartButton.GetComponentInChildren <Text>(); foreach (Image ima in buttonImages) { ima.DOFade(1, 5f); } buttonText.DOFade(1, 5); } else { moralBG.DOFade(0, 2); moralText.gameObject.SetActive(false); moralText.alpha = 0; restartButton.SetActive(false); } }
/// <summary> /// This function helper for draw floating text on the screen. /// </summary> public void DrawFloatingText(string text, Vector2 position) { if (GameManager.IsGameOver()) { return; } TMP_Text createdFloatingText = Instantiate(GameManager.Instance.GetGameSettings().FloatingTextPrefab, GetCanvas().transform); createdFloatingText.text = text; createdFloatingText.transform.localPosition = position; Sequence sequence = DOTween.Sequence(); sequence.Join(createdFloatingText.transform.DOScale(Vector3.one, 0.5F)); sequence.Join(createdFloatingText.transform.DOLocalMoveY(createdFloatingText.transform.localPosition.y + 250, 1)); sequence.Join(createdFloatingText.DOFade(0, 0.5F).SetDelay(0.5F)); sequence.OnComplete(() => { Destroy(createdFloatingText.gameObject); }); sequence.Play(); }
public void EndGame() { BoardController.enabled = false; BlockManager.KillBlocks(); EliminatedText.enabled = true; EliminatedText.transform.DOMoveY(1f, 1f); EliminatedText.DOFade(1f, 1f); }
private void Effect(float fadeTime) { TMP_Text effectText = Instantiate(timerText, transform).GetComponent <TMP_Text>(); effectText.GetComponent <RectTransform>().DOScale(5f, fadeTime); effectText.DOFade(0.0f, fadeTime); Destroy(effectText, fadeTime); }
/// <summary> /// Animates the in. /// </summary> /// <param name="time">The time.</param> /// <param name="delay">The delay.</param> public void AnimateIn(float time = 0.5f, float delay = 0.0f) { if (instancedLineMaterial != null) { for (int i = 0; i < wireRenderer.Length; i++) { wireRenderer[i].enabled = true; } instancedLineMaterial.DOKill(); instancedLineMaterial.DOFloat(1.0f, "_Alpha", time).SetEase(Ease.InOutSine).SetDelay(delay); LabelWidth.DOFade(1.0f, time).SetEase(Ease.InOutSine).SetDelay(delay); LabelHeight.DOFade(1.0f, time).SetEase(Ease.InOutSine).SetDelay(delay); LabelDepth.DOFade(1.0f, time).SetEase(Ease.InOutSine).SetDelay(delay); } }
private IEnumerator GameOverSequence() { yield return(new WaitForSeconds(0.5f)); _gameOverText.text = "You've been consumed by the darkness"; _gameOverText.DOFade(1f, 1.5f); yield return(new WaitForSeconds(1f + 1.5f)); _gameOverText.DOFade(0f, 0.45f); yield return(new WaitForSeconds(0.5f + 0.45f)); _gameOverText.text = "Your light shines no more"; _gameOverText.DOFade(1f, 1.5f); yield return(new WaitForSeconds(0.5f + 1.5f)); _gameOverText.DOFade(0f, 0.45f); yield return(new WaitForSeconds(0.5f + 0.45f)); _gameOverText.text = string.Format("Game over\nYou survived for {0}", TimeUtil.SecondsToDigitalClock(GameManager.TimeScore)); _gameOverText.DOFade(1f, 1.5f); yield return(new WaitForSeconds(1f + 1.5f)); foreach (var button in _buttons) { button.gameObject.SetActive(true); } foreach (var buttonImage in _buttonImageGroups) { buttonImage.DOFade(1f, 0.45f); } yield return(new WaitForSeconds(0.45f)); _joystickEventSystem.ScanForButtons(); if (_buttons.Length > 0) { _joystickEventSystem.SetSelectedGameObject(_buttons[0].gameObject); } }
public void SetQuestionGreen() { answerSprite.enabled = true; answerSprite.Material.DOColor(SpecialGreen, 0.5f); hiddenQuestionSprite.Material.DOFade(0, 1); Label.alpha = 0; Label.DOFade(1, 0.6f); MegaphoneIcon.DOFade(0, 0.3f); }
private void Start() { var fadeAnimation = DOTween.Sequence(); fadeAnimation.Append(madeBy0.DOFade(1, 1).SetLoops(2, LoopType.Yoyo)); fadeAnimation.Append(madeBy1.DOFade(1, 1).SetLoops(2, LoopType.Yoyo)); fadeAnimation.Append(madeBy2.DOFade(1, 1).SetLoops(2, LoopType.Yoyo)); fadeAnimation.Append(madeBy3.DOFade(1, 1).SetLoops(2, LoopType.Yoyo)); fadeAnimation.OnComplete(() => StartCoroutine(TextApear())); }
private IEnumerator Sequence() { var endY = transform.position.y + _floatDistance; transform.DOMoveY(endY, _floatDuration); yield return(new WaitForSeconds(0.8f)); _textField.DOFade(0f, _floatDuration).OnComplete(() => Destroy(gameObject)); }