Beispiel #1
0
        /// <summary>
        /// Destroys the internal animation representation.
        /// </summary>
        private void DestroyNative()
        {
            if (animatedRenderable != null)
            {
                animatedRenderable.UnregisterAnimation();
            }

            if (_native != null)
            {
                _native.Destroy();
                _native = null;
            }

            primaryClip = null;
            mappingInfo.Clear();
            floatProperties = null;
        }
Beispiel #2
0
        /// <summary>
        /// Creates the internal representation of the animation and restores the values saved by the component.
        /// </summary>
        private void RestoreNative()
        {
            if (_native != null)
            {
                _native.Destroy();
            }

            _native = new NativeAnimation();
            _native.OnEventTriggered += EventTriggered;

            animatedRenderable = SceneObject.GetComponent <Renderable>();

            // Restore saved values after reset
            _native.WrapMode = serializableData.wrapMode;
            _native.Speed    = serializableData.speed;
            _native.Cull     = serializableData.cull;

            UpdateBounds();

            if (serializableData.defaultClip != null)
            {
                _native.Play(serializableData.defaultClip);
            }

            primaryClip = _native.GetClip(0);
            if (primaryClip != null)
            {
                RebuildFloatProperties(primaryClip);
            }

            SetBoneMappings();
            UpdateSceneObjectMapping();

            if (animatedRenderable != null)
            {
                animatedRenderable.RegisterAnimation(this);
            }
        }
 private static extern void Internal_Create(NativeAnimation instance);