﻿// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2025 Kybernetik //

#if LITE
#if ! UNITY_EDITOR
#pragma warning disable CS0618 // Type or member is obsolete (for Layers in Animancer Lite).
#endif
#endif
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.

using UnityEngine;

namespace Animancer.Samples.Blending
{
    /// <summary>Demonstrates how to use <see cref="WeightedMaskLayers"/>.</summary>
    /// 
    /// <remarks>
    /// <strong>Sample:</strong>
    /// <see href="https://kybernetik.com.au/animancer/docs/samples/blending/weighted-mask-layers">
    /// Weighted Mask Layers</see>
    /// </remarks>
    /// 
    /// https://kybernetik.com.au/animancer/api/Animancer.Samples.Blending/PlayLayeredAnimationsOnEnable
    /// 
    [AddComponentMenu(Strings.SamplesMenuPrefix + "Blending - Play Layered Animations On Enable")]
    [AnimancerHelpUrl(typeof(PlayLayeredAnimationsOnEnable))]
    public class PlayLayeredAnimationsOnEnable : MonoBehaviour
    {
        /************************************************************************************************************************/

        [SerializeField] private AnimancerComponent _Animancer;
        [SerializeField] private ClipTransition[] _Animations;

        /************************************************************************************************************************/

        protected virtual void OnEnable()
        {
            for (int i = 0; i < _Animations.Length; i++)
                _Animancer.Layers[i].Play(_Animations[i]);
        }

        /************************************************************************************************************************/
    }
}