void Start() { _status = HingeStatus.unpicked; interact = gameObject.GetComponentInParent <HingeController>().Interact.GetComponent <InteractController>(); interact.HideArea(); this.gameObject.AddComponent <BoxCollider>(); }
private void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit) && hit.collider.gameObject == this.gameObject) { if (_status == HingeStatus.unpicked) { _status = HingeStatus.mouseOn; interact.ShowArea(); } } else { _status = HingeStatus.unpicked; interact.HideArea(); } }