コード例 #1
0
        public void AddLayer(int index, AnimationLayerType type, float weight, AvatarMask mask = null)
        {
            AnimationLayer newLayer = new AnimationLayer();

            newLayer.type        = type;
            newLayer.startWeight = weight;
            newLayer.states      = new List <AnimationPlayerState>();
            newLayer.transitions = new List <StateTransition>();
            newLayer.mask        = mask;

            AnimationLayer[] newLayers = new AnimationLayer[layers.Length + 1];
            for (int i = 0; i < newLayers.Length; i++)
            {
                if (i < index)
                {
                    newLayers[i] = layers[i];
                }
                else if (i == index)
                {
                    newLayers[i] = newLayer;
                }
                else
                {
                    newLayers[i] = layers[i - 1];
                }
            }
            layers = newLayers;

            layers[index].InitializeSelf(graph, defaultTransition, clipSwapCollections, blendVariableValues);
        }
コード例 #2
0
 private void SetControllerToAnimationLayer(VRCAvatarDescriptor avatar, AnimationLayerType layerType, AnimatorController controller)
     => SetControllerToAnimationLayer(avatar, (int)layerType, controller, false);