public static void RegisterAnimator(GPUAnimator animator)
 {
     if (Instance)
     {
         mAnimators.Add(animator);
     }
 }
    private void Update()
    {
        float t = Time.time;
        int   c = mAnimators.Count;

        for (int i = 0; i < c; i++)
        {
            GPUAnimator animator = mAnimators[i];
            if (t >= animator.nextTick)
            {
                animator.UpdateTick(t);
            }
        }
    }
Ejemplo n.º 3
0
                protected override void UpdateProperties()
                {
                    base.UpdateProperties();

                    int numRenderedInstances = GetNumRenderedInstances();

                    int index = 0;

                    for (int i = 0; i < numRenderedInstances; i++)
                    {
                        int instanceIndex = GetRenderedInstanceIndex(i);

                        GPUAnimator animator = (GPUAnimator)_instanceData[instanceIndex]._animator;

                        //Work out what other layer has heighest weight
                        int   secondLayerIndex  = 1;
                        float secondLayerWeight = animator.GetLayerWeight(secondLayerIndex);

                        for (int j = 2; j < animator.GetNumLayers(); j++)
                        {
                            float weight = animator.GetLayerWeight(j);

                            if (weight > secondLayerWeight)
                            {
                                secondLayerIndex  = j;
                                secondLayerWeight = weight;
                            }
                        }

                        _secondLayerWeights[index]                   = secondLayerWeight;
                        _secondLayerMainAnimationFrames[index]       = animator.GetMainAnimationFrame(secondLayerIndex);
                        _secondLayerMainAnimationWeights[index]      = animator.GetMainAnimationWeight(secondLayerIndex);
                        _secondLayerBackgroundAnimationFrames[index] = animator.GetBackgroundAnimationFrame(secondLayerIndex);

                        index++;
                    }

                    _propertyBlock.SetFloatArray("_layerTwoWeight", _secondLayerWeights);
                    _propertyBlock.SetFloatArray("_layerTwoMainAnimFrame", _secondLayerMainAnimationFrames);
                    _propertyBlock.SetFloatArray("_layerTwoMainAnimWeight", _secondLayerMainAnimationWeights);
                    _propertyBlock.SetFloatArray("_layerTwoBackgroundAnim", _secondLayerBackgroundAnimationFrames);
                }
 public static void UnregisterAnimator(GPUAnimator animator)
 {
     mAnimators.Remove(animator);
 }