Example #1
0
            public void AddChannel(string name)
            {
                if (morphStates.Length > 0 && computer.pointCount != morphStates[0].points.Length)
                {
                    Debug.LogError("Point count must be the same as " + computer.pointCount);
                    return;
                }
                SplineMorphState newMorph = new SplineMorphState();

                newMorph.points = computer.GetPoints(SplineComputer.Space.Local);
                newMorph.name   = name;
                if (morphStates.Length > 0)
                {
                    newMorph.percent = 0f;
                }
                SplineMorphState[] newMorphs = new SplineMorphState[morphStates.Length + 1];
                morphStates.CopyTo(newMorphs, 0);
                morphStates = newMorphs;
                morphStates[morphStates.Length - 1] = newMorph;
            }
Example #2
0
 public void RemoveChannel(int index)
 {
     if (index < 0 || index >= morphStates.Length)
     {
         return;
     }
     SplineMorphState[] newStates = new SplineMorphState[morphStates.Length - 1];
     for (int i = 0; i < morphStates.Length; i++)
     {
         if (i == index)
         {
             continue;
         }
         else if (i < index)
         {
             newStates[i] = morphStates[i];
         }
         else if (i >= index)
         {
             newStates[i - 1] = morphStates[i];
         }
     }
     morphStates = newStates;
 }