예제 #1
0
파일: Book.cs 프로젝트: iRandz/EyeTracking
 // Start is called before the first frame update
 void Start()
 {
     height           = new Vector3(0, gameObject.transform.lossyScale.y / 2, 0);
     _renderer        = gameObject.GetComponent <Renderer>();
     _collider        = gameObject.GetComponent <Collider>();
     _interaction     = bookShelf.GetComponent <BookShelfInteraction>();
     _lookedAt        = bookShelf.GetComponent <BookShelfIsLookedAt>();
     _winStateManager = bookShelf.GetComponent <WinStateManager>();
     _winStateManager.RegisterPuzzleObject();
     _interactableObject = gameObject.GetComponent <InteractableObject>();
 }
예제 #2
0
파일: Book.cs 프로젝트: iRandz/EyeTracking
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
        }

        Debug.DrawRay(transform.position, -transform.right, Color.green);
        RaycastHit hit;

        if (Physics.SphereCast(Camera.main.transform.position, 0.1f, Camera.main.transform.forward, out hit, 100))
        {
            BookShelfInteraction bookShelf = hit.collider.gameObject.GetComponent <BookShelfInteraction>();

            if (bookShelf != null && bookShelf != bookShelfInFocus && hasBeenPickedUp)  //&& mold != moldInFocus
            {
                SetFocus(bookShelf);
            }
            else if (bookShelf == null || !hasBeenPickedUp)
            {
                RemoveFocus();
            }
        }

        void SetFocus(BookShelfInteraction newFocus)
        {
            //if (newFocus != moldInFocus)
            //{
            if (bookShelfInFocus != null)
            {
                bookShelfInFocus.OnDefocus();
            }

            bookShelfInFocus = newFocus;
            bookShelfInFocus.OnFocus();
            //}
        }

        void RemoveFocus()
        {
            if (bookShelfInFocus != null)
            {
                bookShelfInFocus.OnDefocus();
            }

            bookShelfInFocus = null;
        }
    }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     _gazeAwareComponent   = GetComponent <GazeAware>();
     _bookShelfInteraction = GetComponent <BookShelfInteraction>();
     randomWaitTime        = Random.Range(5f, 10f);
 }