Ejemplo n.º 1
0
        public override bool Act(AController controller, TimeSpan totalTime, TimeSpan elapsed, bool dTime)
        {
            const float spinSpeed = .049f;

            m_angle += spinSpeed * (float)elapsed.TotalMilliseconds;

            Vector2 point = controller.WindowHandle.Size();

            point.x /= 3;
            point.y /= 3;
            point.x += (int)((float)Math.Cos(m_angle) * controller.WindowHandle.Size().x / 4);
            point.y += (int)((float)Math.Sin(m_angle) * controller.WindowHandle.Size().x / 4);
            if (m_init)
            {
                m_init = false;
                controller.Press(point.x, point.y);
            }
            controller.Move(point.x, point.y);
            if (totalTime.TotalMilliseconds >= m_spinData.EndTime)
            {
                controller.Release(point.x, point.y);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public override bool Act(AController controller, TimeSpan totalTime, TimeSpan elapsed, bool dTime)
        {
            const float spinSpeed = .049f;

            m_angle += spinSpeed * (float)elapsed.TotalMilliseconds;

            Vector2 point = controller.WindowHandle.Size();
            point.x /= 3;
            point.y /= 3;
            point.x += (int)((float)Math.Cos(m_angle) * controller.WindowHandle.Size().x / 4);
            point.y += (int)((float)Math.Sin(m_angle) * controller.WindowHandle.Size().x / 4);
            if (m_init)
            {
                m_init = false;
                controller.Press(point.x, point.y);
            }
            controller.Move(point.x, point.y);
            if (totalTime.TotalMilliseconds >= m_spinData.EndTime)
            {
                controller.Release(point.x, point.y);
                return true;
            }
            return false;
        }
Ejemplo n.º 3
0
        public override bool Act(AController controller, TimeSpan totalTime, TimeSpan elapsed, bool dTime)
        {
            if (m_init)
            {
                m_init = false;
                m_curX = m_sliderData.HitData.X;
                m_curY = m_sliderData.HitData.Y;
                controller.Press((int)m_curX, (int)m_curY);
            }
            m_totalElapsed += elapsed;
            //Console.WriteLine(m_curId + " " + m_sliderData.Points.Count + m_millisecondsToComplete);
            if (m_totalElapsed.TotalMilliseconds >= m_millisecondsToComplete + 10)
            {
                if (CheckIfRepeat() == false)
                {
                    controller.Release((int)m_curX, (int)m_curY);
                    return(true);
                }
                else
                {
                    if (m_sliderData.DataDistance >= MIN_SLIDER_DISTANCE)
                    {
                        controller.Move((int)m_curX, (int)m_curY);
                    }
                }
            }
            else if (m_curId < m_sliderData.Points.Count)
            {
                WinAPI.POINT destination = new WinAPI.POINT();
                float        msPerPoint  = m_millisecondsToComplete / ((float)m_sliderData.Points.Count - 1);

                destination = m_sliderData.Points[m_curId];
                if (m_curId == 0)
                {
                    m_curX = destination.x;
                    m_curY = destination.y;
                    controller.Move((int)m_curX, (int)m_curY);
                    IncreaseId(controller);
                }
                else
                {
                    float angleX = destination.x - m_curX;
                    float angleY = destination.y - m_curY;

                    float angle = (float)Math.Atan2(angleY, angleX);
                    float addX  = (float)Math.Cos(angle);
                    float addY  = (float)Math.Sin(angle);

                    if (m_checkChange)
                    {
                        m_checkChange = false;
                        m_checkX      = true;
                        m_checkY      = true;
                        if (m_curX < destination.x)
                        {
                            m_checkX = false;
                        }
                        if (m_curY < destination.y)
                        {
                            m_checkY = false;
                        }
                    }

                    const float BRUTE_FORCE_SLOWDOWN = .94f; //Have no idea why I need to do this, but my shit goes too fast
                    if (m_sliderData.Distance >= MIN_SLIDER_DISTANCE)
                    {
                        m_curX += addX * (((float)m_sliderData.Distance / m_millisecondsToComplete) * (float)elapsed.TotalMilliseconds) * BRUTE_FORCE_SLOWDOWN;
                        m_curY += addY * (((float)m_sliderData.Distance / m_millisecondsToComplete) * (float)elapsed.TotalMilliseconds) * BRUTE_FORCE_SLOWDOWN;

                        bool[] complete = new bool[2] {
                            false, false
                        };
                        if (!m_checkX)
                        {
                            if (m_curX >= destination.x)
                            {
                                complete[0] = true;
                            }
                        }
                        else
                        {
                            if (m_curX <= destination.x)
                            {
                                complete[0] = true;
                            }
                        }
                        if (!m_checkY)
                        {
                            if (m_curY >= destination.y)
                            {
                                complete[1] = true;
                            }
                        }
                        else
                        {
                            if (m_curY <= destination.y)
                            {
                                complete[1] = true;
                            }
                        }
                        if (complete[0] && complete[1])
                        {
                            IncreaseId(controller);
                        }
                    }
                    controller.Move((int)m_curX, (int)m_curY);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override bool Act(AController controller, TimeSpan totalTime, TimeSpan elapsed, bool dTime)
        {
            if (m_init)
            {
                m_init = false;
                m_curX = m_sliderData.HitData.X;
                m_curY = m_sliderData.HitData.Y;
                controller.Press((int)m_curX, (int)m_curY);
            }
            m_totalElapsed += elapsed;
            //Console.WriteLine(m_curId + " " + m_sliderData.Points.Count + m_millisecondsToComplete);
            if (m_totalElapsed.TotalMilliseconds >= m_millisecondsToComplete + 10)
            {
                if (CheckIfRepeat() == false)
                {
                    controller.Release((int)m_curX, (int)m_curY);
                    return true;
                }
                else
                {
                    if(m_sliderData.DataDistance >= MIN_SLIDER_DISTANCE)
                        controller.Move((int)m_curX, (int)m_curY);
                }
            }
            else if(m_curId < m_sliderData.Points.Count)
            {
                WinAPI.POINT destination = new WinAPI.POINT();
                float msPerPoint = m_millisecondsToComplete / ((float)m_sliderData.Points.Count - 1);

                destination = m_sliderData.Points[m_curId];
                if (m_curId == 0)
                {
                    m_curX = destination.x;
                    m_curY = destination.y;
                    controller.Move((int)m_curX, (int)m_curY);
                    IncreaseId(controller);
                }
                else
                {

                    float angleX = destination.x - m_curX;
                    float angleY = destination.y - m_curY;

                    float angle = (float)Math.Atan2(angleY, angleX);
                    float addX = (float)Math.Cos(angle);
                    float addY = (float)Math.Sin(angle);

                    if (m_checkChange)
                    {
                        m_checkChange = false;
                        m_checkX = true;
                        m_checkY = true;
                        if (m_curX < destination.x)
                        {
                            m_checkX = false;
                        }
                        if (m_curY < destination.y)
                        {
                            m_checkY = false;
                        }
                    }

                    const float BRUTE_FORCE_SLOWDOWN = .94f; //Have no idea why I need to do this, but my shit goes too fast
                    if (m_sliderData.Distance >= MIN_SLIDER_DISTANCE)
                    {
                        m_curX += addX * (((float)m_sliderData.Distance / m_millisecondsToComplete) * (float)elapsed.TotalMilliseconds) * BRUTE_FORCE_SLOWDOWN;
                        m_curY += addY * (((float)m_sliderData.Distance / m_millisecondsToComplete) * (float)elapsed.TotalMilliseconds) * BRUTE_FORCE_SLOWDOWN;

                        bool[] complete = new bool[2] { false, false };
                        if (!m_checkX)
                        {
                            if (m_curX >= destination.x)
                            {
                                complete[0] = true;
                            }
                        }
                        else
                        {
                            if (m_curX <= destination.x)
                            {
                                complete[0] = true;
                            }
                        }
                        if (!m_checkY)
                        {
                            if (m_curY >= destination.y)
                            {
                                complete[1] = true;
                            }
                        }
                        else
                        {
                            if (m_curY <= destination.y)
                            {
                                complete[1] = true;
                            }
                        }
                        if (complete[0] && complete[1])
                        {
                            IncreaseId(controller);
                        }
                    }
                    controller.Move((int)m_curX, (int)m_curY);
                }
            }

            return false;
        }