using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Contains information about what animation to sample and at which point.
    /// </summary>
    public struct AnimSampleInstruction
    {
        public AssetAddress Anim;
        public float SampleTime;
        public float OffsetTime;

        public AnimSampleInstruction(AssetAddress anim)
        {
            Anim = anim;
            SampleTime = 1;
            OffsetTime = 0;
        }

        public AnimSampleInstruction(AssetAddress anim, float sampleTime)
        {
            Anim = anim;
            SampleTime = sampleTime;
            OffsetTime = 0;
        }

        public AnimSampleInstruction(AssetAddress anim, float sampleTime, float offsetTime)
        {
            Anim = anim;
            SampleTime = sampleTime;
            OffsetTime = offsetTime;
        }

        public readonly IAnimSampling Sample(IWrestler w) => w.SampleAnim(Anim, SampleTime, OffsetTime);
        public readonly IAnimSampling Sample(IWrestler w, Vector3 faceDir) => w.SampleAnim(Anim, SampleTime, faceDir, OffsetTime);
        public readonly IAnimSampling Sample(IWrestler w, Vector3 pos, Vector3 faceDir) => w.SampleAnim(Anim, SampleTime, pos, faceDir, OffsetTime);
    }
}
