예제 #1
0
 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);
     }
 }
예제 #2
0
    private IEnumerator Die()
    {
        Tween t = signSprite.DOFade(0f, 0.2f);

        yield return(t.WaitForCompletion());

        Destroy(gameObject);
    }
예제 #3
0
    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();
    }
예제 #4
0
 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());
 }
예제 #5
0
 public IEnumerator FadeIn(float seconds)
 {
     yield return(_sprite.DOFade(1f, seconds).WaitForCompletion());
 }
예제 #6
0
 public Tween GetFadeInTween(float time)
 {
     return(DOTween.Sequence()
            .Append(_headSprite.DOFade(1, time))
            .Insert(0, _bodySprite.DOFade(1, time)));
 }