Пример #1
0
    /// <summary>
    /// Runs the animation, as this isn't a monoobject we'll need to provide the update step
    /// </summary>
    /// <returns>Returns true if the animation has been completely finished, if the OnFinish function has been called</returns>
    public bool RunUpdate()
    {
        //The main loop on animations
        switch (m_CurrentState)
        {
        //Called once and instantly parmed off to the OnUpdate stage
        case CustomAnimationCurrentState.OnStart:
        {
            OnStart();
            m_CurrentState = CustomAnimationCurrentState.OnUpdate;
            break;
        }

        //Calls OnUpdate and listens for a returned true, if it gets it, move to the finish stage
        case CustomAnimationCurrentState.OnUpdate:
        {
            if (OnUpdate() == true)
            {
                m_CurrentState = CustomAnimationCurrentState.OnFinish;
            }
            break;
        }

        //Called once at the end
        case CustomAnimationCurrentState.OnFinish:
        {
            OnFinish();
            m_CurrentState = CustomAnimationCurrentState.NULL;
            return(true);
        }
        }

        //In all other stages except the very last update, return false
        return(false);
    }
Пример #2
0
 /// <summary>
 /// Starts the animation, needs to be called first
 /// Same effect can happen by just setting the current state
 /// </summary>
 public void RunStart()
 {
     if (m_CurrentState == CustomAnimationCurrentState.NULL)
     {
         m_CurrentState = CustomAnimationCurrentState.OnStart;
     }
 }