Example #1
0
            private void Update()
            {
                AnimationTexture.Animation animation = _animationTexture.GetAnimations()[0];

                _currentFrame += Time.deltaTime * animation._fps;

                if (_currentFrame + 1 > animation._totalFrames)
                {
                    _currentFrame = 0.0f;
                }

                _material.GetMaterial().SetFloat("frameIndex", _currentFrame);
                _material.GetMaterial().SetFloat("preFrameIndex", -1.0f);
                _material.GetMaterial().SetFloat("transitionProgress", -1.0f);

                Graphics.DrawMeshInstanced(_skinnedMesh.sharedMesh, 0, _material, new Matrix4x4[] { this.transform.localToWorldMatrix }, 1);
            }
Example #2
0
 private AnimationTexture.Animation GetAnimation(int index)
 {
     AnimationTexture.Animation[] animations = _animationTexture.GetAnimations();
     AnimationTexture.Animation   animation  = animations[Mathf.Clamp(index, 0, animations.Length)];
     return(animation);
 }