예제 #1
0
 public void ActivateLayer(string layerName)
 {
     for (int i = 0; i < MyAnimator.layerCount; i++)
     {
         MyAnimator.SetLayerWeight(i, 0);
     }
     MyAnimator.SetLayerWeight(MyAnimator.GetLayerIndex(layerName), (1));
 }
예제 #2
0
    public void ActivateLayer(string layerName)
    {
        //this is a Looping structure.  initially i is set to 0 (inactive).  Then the loop runs while i is less than the number of layers
        // adding 1 to i in each loop
        for (int i = 0; i < MyAnimator.layerCount; i++)
        {
            //sets layer weight to 0 for every layer as the loop runs. this "resets" all the layers
            MyAnimator.SetLayerWeight(i, 0);
        }

        //sets the Layer Weight for the layer specified in layername to 1 (active)
        MyAnimator.SetLayerWeight(MyAnimator.GetLayerIndex(layerName), 1);
    }