Пример #1
0
    public virtual void TransitionTechnique(Technique technique = null, bool blend = true)
    {
        if (activeTechnique != technique)
        {
            if (ValidActiveTechnique())
            {
                activeTechnique.Exit();
            }
            activeTechnique = technique;
            if (technique != null && technique.IsValid())
            {
                technique.Activate();
            }
        }

        if (blend && !animator.GetCurrentAnimatorStateInfo(0).IsName(transitionStateName))
        {
            animator.SetBool(transitionBool, true);
        }
        else
        {
            if (technique == null)
            {
                animatorController = baseController;
                animator.SetBool(transitionBool, false);
            }
            else
            {
                animatorController = technique.animatorController;
                animator.SetBool(transitionBool, false);
            }
        }

        TechniqueEvent handler = TechniqueChange;

        if (handler != null)
        {
            handler(activeTechnique);
        }
    }