using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Represents a target in the world space.
    /// </summary>
    public interface ITarget
    {
        /// <summary>
        /// The current world position of the target.
        /// </summary>
        Vector3 Position { get; }

        /// <summary>
        /// Offsets the target.
        /// </summary>
        /// <param name="v">the offset vector</param>
        /// <returns>this target</returns>
        ITarget OffsetBy(Vector3 v);

        /// <summary>
        /// Projects the target onto the given ray.
        /// </summary>
        /// <param name="ray">the ray</param>
        /// <returns>this target</returns>
        ITarget OnRay(IRay ray);

        /// <summary>
        /// Projects the target onto the ground if possible.
        /// 
        /// Nothing happens if no ground is found beneath the target.
        /// </summary>
        /// <param name="scanDistance">the scan distance</param>
        /// <returns>this target</returns>
        ITarget OnGround(float scanDistance = 0.5f);

        /// <summary>
        /// Linearly interpolates between this and another target.
        /// </summary>
        /// <param name="p">the other target</param>
        /// <param name="t">the interpolation point</param>
        /// <returns>this target</returns>
        ITarget LerpTo(ITarget p, float t);

        /// <summary>
        /// Offsets the target towards another target.
        /// </summary>
        /// <param name="p">the other target</param>
        /// <param name="distance">the distance from the current target</param>
        /// <returns>this target</returns>
        ITarget TowardsTarget(ITarget p, float distance);

        /// <summary>
        /// Offsets the target towards a direction.
        /// </summary>
        /// <param name="d">the direction</param>
        /// <param name="distance">the distance from the current target</param>
        /// <returns>this target</returns>
        ITarget TowardsDirection(IDirection d, float distance);
    }
}
