Beispiel #1
0
 public Bot(IClicker clicker, IScreenCapture screenCapture, IList <TeraPixel> rod)
 {
     this.m_Clicker         = clicker;
     this.m_ScreenCapture   = screenCapture;
     this.m_rod             = rod;
     this.m_searchWithDelta = new SearchWithDeltaEColorCompare(this.m_rod);
 }
    public FishingMachine(IClicker clicker, IScreenCapture screenCapture, ISearchStrategy searchStrategy, CancellationToken mToken = default)
    {
        this.m_Clicker        = clicker;
        this.m_ScreenCapture  = screenCapture;
        this.m_SearchStrategy = searchStrategy;
        this.m_token          = mToken;

        this._stateMachine = new StateMachine <State, Trigger>(State.LookingForHook);
        ConfigureStateMachine();
    }
Beispiel #3
0
        public Bot(int processId, IAsyncRecogniser recogniser, IRepository <TestQuestion> testRepository, IRepository <NumericQuestion> numberRepository, ICutter cutter, IClicker clicker, IReopener reopener)
        {
            _process = Process.GetProcesses().FirstOrDefault(p => p.Id == processId);
            if (_process == null)
            {
                Console.WriteLine("Процесс не найден");
                throw new Exception();
            }
            _recogniserAsync = recogniser;
            mode             = SyncMode.Async; // Ассинхронный распознаватель

            _testRepository    = testRepository;
            _numericRepository = numberRepository;
            _cutter            = cutter;
            _clicker           = clicker;
            _reopener          = reopener;
        }
    private void Update()
    {

        Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width, Screen.height, 0f) / 2f);

        /*TESTING*/
        /*UNCOMMENT FOR USING MOUSE*/
        //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        RaycastHit hit;

        //if (Physics.Raycast(ray, out hit))
        /*UNCOMMENT FOR USING GAZE*/
        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            //Debug.Log("i hit something");
            //draw a line we can see in the scene
            Debug.DrawLine(transform.position, hit.point, Color.cyan);

            //am i hitting something with an iclicker??
            var c = hit.transform.GetComponent<IClicker>();

            //if yes
            if (c != null)
            {
                // we are hovering
                if (current == null)
                {
                    current = c;
                    //call hover of what we are hovering
                    current.OnHover();
                    //start the timer
                    timer = delay;
                }
                //if we are no longer hovering an object but start hovering something else right away
                else if (current != c)
                {
                    //call onexithover of what we hovered
                    current.OnExitHover();
                    //change what we are hovering
                    current = c;
                    //call onhover
                    current.OnHover();
                    //reset the timer to 0 as to not mess up the gaze
                    timer = delay;
                }
                //use fire1 to click
                if (Input.GetButtonDown("Fire1"))
                {
                    c.EndTurn();
                    timer = 0f;
                }
                //wait for the gaze timer to reach 2 seconds and click for you
                else if (Timer > 0f)
                {
                    timer -= Time.unscaledDeltaTime;

                    if (Timer <= 0f)
                    {
                        c.EndTurn();
                    }
                }
            }
            // if we stopped hovering and arent hovering something else hoverable call only exit and set current to null
            else if (current != null)
            {
                current.OnExitHover();
                current = null;
            }
        }
        else
        {
            //draw red if we arent hitting anything
            Debug.DrawRay(transform.position, transform.forward * 10, Color.red);
        }
    }
Beispiel #5
0
 public BookInfoSeeker(IClicker clicker)
 {
     Clicker = clicker;
 }