public void Play(StopMotionSequencer next, bool resetAnimation)
    {
        if (next == active && next.IsPlaying || next == null)
        {
            Debug.LogWarning(next == null ? "Can't play null sequence" : "Next and current animations are the same '" + next.SequenceName + "'");
            return;
        }

        if (active && active != next)
        {
            active.Stop();
            if (OnAnimationEvent != null)
            {
                OnAnimationEvent(active, AnimEventType.StopPlaying);
            }
        }

        if (next)
        {
            next.Play(resetAnimation, OnAnimationEnd);
            active = next;
            if (OnAnimationEvent != null)
            {
                OnAnimationEvent(active, AnimEventType.StartPlaying);
            }
            //Debug.Log(name + ": Changed active sequence to " + active.SequenceName);
        }
    }
 private void StopMotionAnimator_OnSequenceFrame(StopMotionSequencer sequencer)
 {
     if (OnAnimationEvent != null)
     {
         OnAnimationEvent(sequencer, AnimEventType.NewFrame);
     }
 }
    public void ActivateByName(string sequenceName)
    {
        StopMotionSequencer next = GetSequenceByName(sequenceName);

        if (next)
        {
            if (active == next)
            {
                Debug.LogWarning("Next and current animations are the same '" + next.SequenceName + "'");
            }
            else if (active)
            {
                active.Stop();
                if (OnAnimationEvent != null)
                {
                    OnAnimationEvent(active, AnimEventType.StopPlaying);
                }
            }
            active = next;
        }
        else
        {
            active = null;
            Debug.LogWarning("Requested sequence '" + sequenceName + "' but isn't known.");
        }
    }
    public void PlayByName(string sequenceName, bool resetAnimation)
    {
        StopMotionSequencer next = GetSequenceByName(sequenceName);

        if (next)
        {
            Play(next, resetAnimation);
        }
        else
        {
            active = null;
            Debug.LogWarning("Requested sequence '" + sequenceName + "' but isn't known.");
        }
    }
Beispiel #5
0
    public override void OnInspectorGUI()
    {
        smSeq = target as StopMotionSequencer;
        base.OnInspectorGUI();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Step"))
        {
            smSeq.Step();
        }

        if (GUILayout.Button("Stop"))
        {
            smSeq.Stop();
        }

        EditorGUILayout.EndHorizontal();
    }
 void Ease(StopMotionSequencer a, StopMotionSequencer b)
 {
     throw new System.NotImplementedException();
 }
 public virtual bool CanTrigger(StopMotionAnimator animator, string trigger)
 {
     m_targetSequencer = animator.GetSequenceByName(m_Target);
     //Debug.Log(string.Format("{0} {1} {2} {3} {4} {5} {6}", IsTriggerDriven, trigger, m_Trigger, FromAnyState, animator.ActiveName, transitionSource, m_targetSequencer));
     return(IsTriggerDriven && trigger == m_Trigger && (FromAnyState || animator.ActiveName == transitionSource) && m_targetSequencer != null);
 }
    public bool CanExecute(StopMotionAnimator animator)
    {
        m_targetSequencer = animator.GetSequenceByName(m_Target);

        return(m_targetSequencer != null && (FromAnyState && !animator.HasActiveAnimtion || m_Source == animator.ActiveName) && !IsTriggerDriven);
    }