// Update is called once per frame void Update() { if (foodInteraction.GetHit(selfCollider)) { mouseOver = true; GUIuse.Value = true; if (Input.GetKeyDown(KeyCode.F)) { TakeOutItem(); } } else if (mouseOver) { mouseOver = false; GUIuse.Value = false; } }
// Update is called once per frame void Update() { // show mouse over icon, if this object is raycasted. if (foodInteraction.GetHit(selfCollider) && !foodInteraction.isDrinking) { mouseOver = true; GUIuse.Value = true; if (Input.GetKeyDown(KeyCode.F)) { Drink(); // press use to Drink this. } } // hide mouse over icon, if this object is not raycasted. else if (mouseOver) { mouseOver = false; GUIuse.Value = false; } }