﻿using System;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Attribute to tag animation scripts.
    ///
    /// Animation scripts must be static void methods accepting an <see cref="IAnimPlayback"/> parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class AnimScriptAttribute : Attribute
    {
        /// <summary>
        /// The name of the animation clip this script controls, located in the same bundle.
        ///
        /// This may be null - then the name is the same as the tagged method.
        /// </summary>
        public string AnimClipName { get; private set; }

        /// <summary>
        /// Declares the animation script for the animation with the same name as the tagged method.
        /// </summary>
        public AnimScriptAttribute()
        {
            AnimClipName = null;
        }

        /// <summary>
        /// Declares an animation script.
        /// </summary>
        /// <param name="animClipName">the name of the animation clip this script controls, which must be in the same bundle</param>
        public AnimScriptAttribute(string animClipName)
        {
            AnimClipName = animClipName;
        }
    }
}
