using Otter;
using System.Collections;

namespace GiraffeRoller
{
    public static class FruckertButtonFrames
    { //This was created by Fruckert:
        /// <summary>
        /// Presses a Button for a given amount of frames.
        /// </summary>
        /// <param name="button"></param>
        /// <param name="frames"></param>
        /// <returns></returns>

        public static IEnumerator Press(this Button button, int frames)
        {
            button.ForceState(true);
            yield return Coroutine.Instance.WaitForFrames(frames);
            button.ReleaseState();
        }

        public static IEnumerator PressX(this Axis axis, float amount, int frames)
        {
            axis.ForceStateX(amount);
            yield return Coroutine.Instance.WaitForFrames(frames);
            axis.ReleaseState();
        }

        public static IEnumerator PressY(this Axis axis, float amount, int frames)
        {
            axis.ForceStateY(amount);
            yield return Coroutine.Instance.WaitForFrames(frames);
            axis.ReleaseState();
        }

        public static IEnumerator Press(this Axis axis, float x, float y, int frames)
        {
            axis.ForceState(x, y);
            yield return Coroutine.Instance.WaitForFrames(frames);
            axis.ReleaseState();
        }
    }
}
