public void CheckValue() { // Check fade out if (value == 0) { // Mark ourselves as collected Island.I.TreasureCollected(this); // Remove ourselves value = -1; if (chest.isActiveAndEnabled) { glow.gameObject.SetActive(false); chest.DOFade(0f, 0.2f).OnComplete(Done); } else { pile.DOFade(0f, 0.2f).OnComplete(Done); } return; } // Set visual based on value glow.gameObject.SetActive(false); chest.gameObject.SetActive(false); pile.gameObject.SetActive(false); if (value < 30) { glow.gameObject.SetActive(false); chest.gameObject.SetActive(false); pile.gameObject.SetActive(true); // Fade in pile.DOFade(1f, 0.5f); } else if (value < 100) { glow.gameObject.SetActive(false); chest.gameObject.SetActive(true); pile.gameObject.SetActive(false); // Fade in chest.DOFade(1f, 0.5f); } else if (value >= 100) { glow.gameObject.SetActive(true); chest.gameObject.SetActive(true); pile.gameObject.SetActive(false); // Fade in glow.DOFade(1f, 0.5f); chest.DOFade(1f, 0.5f); } }
private IEnumerator Die() { Tween t = signSprite.DOFade(0f, 0.2f); yield return(t.WaitForCompletion()); Destroy(gameObject); }
public void Awake() { _sp = GetComponent <tk2dSprite>(); // Spin _spinSeq = DOTween.Sequence().SetLoops(-1); _spinSeq.Append(transform.DOScale(new Vector3(0f, 1f), 0.15f)); _spinSeq.Append(transform.DOScale(Vector3.one, 0.15f)); _spinSeq.Pause(); // Fly up and down _upDownSeq = DOTween.Sequence().SetAutoKill(false); _upDownSeq.Append(transform.DOBlendableMoveBy(Vector3.up, 0.2f).SetEase(Ease.OutSine).SetRelative(true)); _upDownSeq.Append(transform.DOBlendableMoveBy(Vector3.down, 0.2f).SetEase(Ease.InSine).SetRelative(true)); _upDownSeq.Pause(); // Fade _fadeTween = _sp.DOFade(0f, 0.2f).SetAutoKill(false).OnComplete(Finish); _fadeTween.Complete(); }
public IEnumerator FadeIn() { _sprite.color = new Color(_sprite.color.r, _sprite.color.g, _sprite.color.b, 0); yield return(_sprite.DOFade(1f, 0.7f).WaitForCompletion()); }
public IEnumerator FadeIn(float seconds) { yield return(_sprite.DOFade(1f, seconds).WaitForCompletion()); }
public Tween GetFadeInTween(float time) { return(DOTween.Sequence() .Append(_headSprite.DOFade(1, time)) .Insert(0, _bodySprite.DOFade(1, time))); }