﻿using System;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Attribute to tag move scripts.
    ///
    /// Move scripts must be static coroutines (ie, return <see cref="System.Collections.IEnumerator"/> and accept an <see cref="IMoveInstance"/> parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class MoveScriptAttribute : Attribute
    {
        /// <summary>
        /// The name of the move 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 MoveName { get; private set; }

        /// <summary>
        /// Declares the move script for the move with the same name as the tagged method.
        /// </summary>
        public MoveScriptAttribute()
        {
            MoveName = null;
        }

        /// <summary>
        /// Declares a move script.
        /// </summary>
        /// <param name="moveName">the name of the move this script controls, which must be in the same bundle</param>
        public MoveScriptAttribute(string moveName)
        {
            MoveName = moveName;
        }
    }
}
