Reset() публичный Метод

Manually reset the active animation to the beginning.
public Reset ( ) : void
Результат void
Пример #1
0
    /// <summary>
    /// Start playing the animation.
    /// </summary>

    public void Play(bool forward, bool onlyIfDifferent)
    {
        if (target || animator)
        {
            if (onlyIfDifferent)
            {
                if (mActivated == forward)
                {
                    return;
                }
                mActivated = forward;
            }

            if (clearSelection && UICamera.selectedObject == gameObject)
            {
                UICamera.selectedObject = null;
            }

            int             pd   = -(int)playDirection;
            Direction       dir  = forward ? playDirection : ((Direction)pd);
            ActiveAnimation anim = target ?
                                   ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished) :
                                   ActiveAnimation.Play(animator, clipName, dir, ifDisabledOnPlay, disableWhenFinished);

            if (anim != null)
            {
                if (resetOnPlay)
                {
                    anim.Reset();
                }
                for (int i = 0; i < onFinished.Count; ++i)
                {
                    EventDelegate.Add(anim.onFinished, OnFinished, true);
                }
            }
        }
    }
    void Play(bool forward)
    {
        if (target == null)
        {
            target = GetComponentInChildren <Animation>();
        }

        if (target != null)
        {
            if (clearSelection && UICamera.selectedObject == gameObject)
            {
                UICamera.selectedObject = null;
            }

            int             pd   = -(int)playDirection;
            Direction       dir  = forward ? playDirection : ((Direction)pd);
            ActiveAnimation anim = ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished);
            if (resetOnPlay)
            {
                anim.Reset();
            }

            // Set the delegate
            anim.onFinished = onFinished;

            // Copy the event receiver
            if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
            {
                anim.eventReceiver    = eventReceiver;
                anim.callWhenFinished = callWhenFinished;
            }
            else
            {
                anim.eventReceiver = null;
            }
        }
    }
Пример #3
0
    private void Play(bool forward)
    {
        Direction direction;

        if (this.target == null)
        {
            this.target = base.GetComponentInChildren <Animation>();
        }
        if (this.target != null)
        {
            if (this.clearSelection && UICamera.selectedObject == base.gameObject)
            {
                UICamera.selectedObject = null;
            }
            int num = -(int)this.playDirection;
            if (!forward)
            {
                direction = (Direction)num;
            }
            else
            {
                direction = this.playDirection;
            }
            Direction       direction1      = direction;
            ActiveAnimation activeAnimation = ActiveAnimation.Play(this.target, this.clipName, direction1, this.ifDisabledOnPlay, this.disableWhenFinished);
            if (this.resetOnPlay)
            {
                activeAnimation.Reset();
            }
            if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
            {
                activeAnimation.eventReceiver    = this.eventReceiver;
                activeAnimation.callWhenFinished = this.callWhenFinished;
            }
        }
    }
Пример #4
0
    private void Play(bool forward)
    {
        if (target == null)
        {
            target = GetComponentInChildren <Animation>();
        }
        if (!(target != null))
        {
            return;
        }
        if (clearSelection && UICamera.selectedObject == base.gameObject)
        {
            UICamera.selectedObject = null;
        }
        int             num             = 0 - playDirection;
        Direction       direction       = (Direction)((!forward) ? num : ((int)playDirection));
        ActiveAnimation activeAnimation = ActiveAnimation.Play(target, clipName, direction, ifDisabledOnPlay, disableWhenFinished);

        if (!(activeAnimation == null))
        {
            if (resetOnPlay)
            {
                activeAnimation.Reset();
            }
            activeAnimation.onFinished = onFinished;
            if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
            {
                activeAnimation.eventReceiver    = eventReceiver;
                activeAnimation.callWhenFinished = callWhenFinished;
            }
            else
            {
                activeAnimation.eventReceiver = null;
            }
        }
    }