Exemple #1
0
    private void Awake()
    {
        m_Animator = GetComponent <Animator>();
        m_Mecanim  = GetComponent <MecanimEventHandler>();
        FindPositions();

        Suitcase.onExited = Suitcase_onExited;
        SuitcaseButton.onClick.AddListener(SuitcaseButton_onClicked);
    }
    /// <summary>
    /// Waits until the given state starts.
    /// </summary>
    static public IEnumerator WaitForStateBegin(this MecanimEventHandler inMecanim, int inStateHash)
    {
        Assert.True(inMecanim != null, "Mecanim is not null.");

        bool   bContinue     = false;
        Action allowContinue = () => { bContinue = true; };

        inMecanim.RegisterOnStateBegin(inStateHash, allowContinue);
        while (!bContinue && inMecanim != null)
        {
            yield return(null);
        }
        if (inMecanim != null)
        {
            inMecanim.UnRegisterOnStateBegin(inStateHash, allowContinue);
        }
        else
        {
            Logger.Warn("Mecanim was destroyed before waiting was finished.");
        }
    }
 /// <summary>
 /// Waits until the given transition ends.
 /// </summary>
 static public IEnumerator WaitForTransitionEnd(this MecanimEventHandler inMecanim, string inStateA, string inStateB, string inLayerName = MecanimEventHandler.DEFAULT_LAYER_NAME)
 {
     return(WaitForTransitionEnd(inMecanim, MecanimEventHandler.GetTransitionHash(inStateA, inStateB, inLayerName)));
 }
 /// <summary>
 /// Waits until the given state ends.
 /// </summary>
 static public IEnumerator WaitForStateEnd(this MecanimEventHandler inMecanim, string inStateName, string inLayerName = MecanimEventHandler.DEFAULT_LAYER_NAME)
 {
     return(WaitForStateEnd(inMecanim, MecanimEventHandler.GetStateHash(inStateName, inLayerName)));
 }