using System;

namespace ftt.Gameplay.AI
{
    /* [Node documentation]
     * 
     * [Must know]
     *  EnemyNodeData compatible.
     */
    public class CheckForDetection : INode
    {
        MinotaurNodeData nodeData;

        Action callback;

        public CheckForDetection(MinotaurNodeData nodeData, Action callback)
        {
            this.nodeData = nodeData;
            this.callback = callback;
        }

        /// <summary>
        /// Call to get the node data passed in the creation of the node.
        /// </summary>
        public MinotaurNodeData GetNodeData()
        {
            return nodeData;
        }

        /// <summary>
        /// Call to check if the agent has found its target OR if he is not a patroller, if true, returns false for early exit.
        /// <para>If the navTo INode returns false, calls the Run method of distanceCheck INode and returns its value.</para>
        /// <para>Returns false if none of the above apply.</para>
        /// </summary>
        public bool Run()
        {
            callback();

            return true;
        }
    }
}