/// <summary> /// Removes renderable from the animation component. Rendering will no longer be affected by animation. /// </summary> internal void UnregisterRenderable() { animatedRenderable = null; }
/// <summary> /// Registers an <see cref="Renderable"/> component with the animation. Rendering will be affected by the animation. /// </summary> /// <param name="renderable">Component that was added</param> internal void RegisterRenderable(Renderable renderable) { animatedRenderable = renderable; UpdateBounds(); }
/// <summary> /// Registers an <see cref="Renderable"/> component with the animation. When registered the animation will use the /// renderable's bounds for culling, and the animation override bounds will be applied to the renderable. /// </summary> /// <param name="renderable">Component that was added</param> internal void RegisterRenderable(Renderable renderable) { animatedRenderable = renderable; UpdateBounds(); }
/// <summary> /// Removes renderable from the animation component. <see cref="RegisterRenderable"/>. /// </summary> internal void UnregisterRenderable() { animatedRenderable = null; }
/// <summary> /// Changes the state of the animation state machine. Doesn't check for valid transitions. /// </summary> /// <param name="state">New state of the animation.</param> private void SwitchState(State state) { this.state = state; switch (state) { case State.Active: 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); break; case State.EditorActive: if (_native != null) _native.Destroy(); _native = new NativeAnimation(); animatedRenderable = SceneObject.GetComponent<Renderable>(); UpdateBounds(); SetBoneMappings(); if (animatedRenderable != null) animatedRenderable.RegisterAnimation(this); break; case State.Inactive: if (animatedRenderable != null) animatedRenderable.UnregisterAnimation(); if (_native != null) { _native.Destroy(); _native = null; } primaryClip = null; mappingInfo.Clear(); floatProperties = null; break; } }