Ejemplo n.º 1
0
        void RayCastByTobii() // 토비 좌표 기준으로 Ray 발사해서 동작 구동.
        {
            data          = new PointerEventData(eventSystem);
            data.position = TobiiAPI.GetGazePoint().Screen;

            // 토비 좌표가 화면 좌표 안에 있을 때만 실행되도록.
            if (!IsNaN(data.position))
            {
                // Ray 발사.
                results = new List <RaycastResult>();
                raycaster.Raycast(data, results);

                if (results.Count > 0)
                {
                    ModeChangeButton modeChangeButton = results[0].gameObject.GetComponent <ModeChangeButton>();
                    VirtualKey       keyButton        = results[0].gameObject.GetComponent <VirtualKey>();
                    DirectionButton  directionButton  = results[0].gameObject.GetComponent <DirectionButton>();
                    HelpButton       helpButton       = results[0].gameObject.GetComponent <HelpButton>();

                    if (modeChangeButton != null)
                    {
                        modeChangeButton.UpdateTimer(Time.deltaTime);
                    }
                    if (keyButton != null)
                    {
                        keyButton.UpdateTimer(Time.deltaTime);
                    }
                    if (directionButton != null)
                    {
                        directionButton.UpdateTimer(Time.deltaTime);
                    }
                    if (helpButton != null)
                    {
                        helpButton.UpdateTimer(Time.deltaTime);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        // 테스트용 (마우스 포인터 위치를 기반으로 키보드 타이핑 하는 메소드).
        void RaycastByMouse()
        {
            data          = new PointerEventData(eventSystem);
            data.position = Input.mousePosition;

            if (!IsNaN(data.position))
            {
                results = new List <RaycastResult>();
                raycaster.Raycast(data, results);

                if (results.Count > 0)
                {
                    GameObject       result           = results[0].gameObject;
                    ModeChangeButton modeChangeButton = result.GetComponent <ModeChangeButton>();
                    VirtualKey       keyButton        = result.GetComponent <VirtualKey>();
                    DirectionButton  directionButton  = result.GetComponent <DirectionButton>();
                    HelpButton       helpButton       = result.GetComponent <HelpButton>();

                    if (modeChangeButton != null)
                    {
                        modeChangeButton.UpdateTimer(Time.deltaTime);
                    }
                    if (keyButton != null)
                    {
                        keyButton.UpdateTimer(Time.deltaTime);
                    }
                    if (directionButton != null)
                    {
                        directionButton.UpdateTimer(Time.deltaTime);
                    }
                    if (helpButton != null)
                    {
                        helpButton.UpdateTimer(Time.deltaTime);
                    }
                }
            }
        }