Example #1
0
    public void PlayIdle(Instance smi)
    {
        KAnimControllerBase component  = smi.GetComponent <KAnimControllerBase>();
        Navigator           component2 = smi.GetComponent <Navigator>();
        NavType             nav_type   = component2.CurrentNavType;
        Facing component3 = smi.GetComponent <Facing>();

        if (component3.GetFacing())
        {
            nav_type = NavGrid.MirrorNavType(nav_type);
        }
        if (smi.def.customIdleAnim != null)
        {
            HashedString pre_anim     = HashedString.Invalid;
            HashedString hashedString = smi.def.customIdleAnim(smi, ref pre_anim);
            if (hashedString != HashedString.Invalid)
            {
                if (pre_anim != HashedString.Invalid)
                {
                    component.Play(pre_anim, KAnim.PlayMode.Once, 1f, 0f);
                }
                component.Queue(hashedString, KAnim.PlayMode.Loop, 1f, 0f);
                return;
            }
        }
        HashedString idleAnim = component2.NavGrid.GetIdleAnim(nav_type);

        component.Play(idleAnim, KAnim.PlayMode.Loop, 1f, 0f);
    }