Пример #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);
                }
            }
        }
        if (gc.number == 7)
        {
            gc.CountScore();
        }
    }