Esempio n. 1
0
 public void Change(String spritName, HonoAvatarTweenPosition.Direction direction, Boolean isKnockOut, Action callBack)
 {
     if (!this.busy && base.gameObject.activeInHierarchy)
     {
         this.busy = true;
         base.StartCoroutine(this.Animate(spritName, direction, isKnockOut, callBack));
     }
 }
Esempio n. 2
0
    private IEnumerator Animate(String spriteName, HonoAvatarTweenPosition.Direction direction, Boolean isKnockOut, Action callBack)
    {
        this.myUISprite.transform.localScale = Vector3.one;
        yield return(new WaitForEndOfFrame());

        this.myUISprite.transform.position = new Vector3(this.startPositionXOffset, this.bgAvatar.transform.position.y);
        if (direction == HonoAvatarTweenPosition.Direction.LeftToRight)
        {
            this.tp.from = new Vector3(-this.startPositionXOffset, 0f, this.myTransform.localPosition.z);
            this.tp.to   = Vector3.zero;
        }
        else
        {
            this.tp.from = new Vector3(this.startPositionXOffset, 0f, this.myTransform.localPosition.z);
            this.tp.to   = Vector3.zero;
        }
        this.myTransform.localPosition = this.tp.from;
        yield return(new WaitForEndOfFrame());

        this.myUISprite.spriteName = spriteName;
        this.myUISprite.alpha      = ((!isKnockOut) ? 1f : 0.5f);
        yield return(new WaitForEndOfFrame());

        this.tp.ResetToBeginning();
        this.tp.enabled = true;
        yield return(new WaitForSeconds(this.tp.duration));

        this.busy = false;
        this.myUISprite.transform.localScale = Vector3.one;
        this.myUISprite.alpha = 0f;
        if (callBack != null)
        {
            callBack();
        }
        yield break;
    }