コード例 #1
0
 private void SetUpAnimationUnit(AnimationUnit unit)
 {
     if (unit.boolVariable != null)
     {
         unit.boolVariable.ObserveChange().Subscribe(_ =>
         {
             _animator.SetBool(unit.name, unit.boolVariable.Value);
         });
     }
     else if (unit.intVariable != null)
     {
         unit.intVariable.ObserveChange().Subscribe(_ =>
         {
             _animator.SetInteger(unit.name, unit.intVariable.Value);
         });
     }
     else if (unit.floatVariable != null)
     {
         unit.floatVariable.ObserveChange().Subscribe(_ =>
         {
             _animator.SetFloat(unit.name, unit.floatVariable.Value);
         });
     }
     else if (unit.atomEvent != null)
     {
         unit.atomEvent.Register(delegate {
             _animator.ResetTrigger(unit.name);
             _animator.SetTrigger(unit.name);
             Debug.Log(unit.name);
         });
     }
 }
コード例 #2
0
    public void CreateAnimationUnit(string name, AnimatorControllerParameterType type, BoolVariable boolVariable = null, IntVariable intVariable = null, FloatVariable floatVariable = null, AtomEvent atomEvent = null)
    {
        AnimationUnit unit = ScriptableObject.CreateInstance <AnimationUnit>();

        unit.name = name;

        if (boolVariable != null)
        {
            unit.boolVariable = boolVariable;
            BoolEvent boolEvent = ScriptableObject.CreateInstance <BoolEvent>();
            boolVariable.Changed = boolEvent;
        }
        else if (intVariable != null)
        {
            unit.intVariable = intVariable;
            IntEvent intEvent = ScriptableObject.CreateInstance <IntEvent>();
            intVariable.Changed = intEvent;
        }
        else if (floatVariable != null)
        {
            unit.floatVariable = floatVariable;
            FloatEvent floatEvent = ScriptableObject.CreateInstance <FloatEvent>();
            floatVariable.Changed = floatEvent;
        }
        else if (atomEvent != null)
        {
            unit.atomEvent = atomEvent;
        }

        AddToAnimationUnits(unit);
        SetUpAnimationUnit(unit);
    }
コード例 #3
0
 public float ReturnMouthState(AnimationUnit au)
 {
     foreach (SkeletonFaceTracker tracker in trackedSkeletons.Values)
     {
         return tracker.getState(au);
     }
     return 0;
 }
コード例 #4
0
 private void AddToAnimationUnits(AnimationUnit newUnit)
 {
     _animationUnits.Append(newUnit);
 }
コード例 #5
0
 public float getState(AnimationUnit au)
 {
     if(frame != null)
         return frame.GetAnimationUnitCoefficients()[au];
     return 0;
 }