public void DoAction() { //"this" is equal to the GameObject (active objects) if (this.GetComponent <ObjectManager>().isActive[1] != null) // if pointed at something { if (this.GetComponent <ObjectManager>().isActive[1].tag == "Storage") // if pointing at shopping bag, add fruit to bag { _PileToCart.Act(); } else if (this.GetComponent <ObjectManager>().isActive[1].transform.root.tag != null && this.GetComponent <ObjectManager>().isActive[1].transform.root.tag == "UI") // if point at screen UI do nothing with fruit { } else { _PileReturn.Act(); // otherwise return the fruit to its pile } } else //if nothing is selected { _PileReturn.Act(); // otherwise return the fruit to its pile } }
public void Act() { if (!(menuUp)) { if (!busy) { //menu.transform.position = new Vector3(-0.573f, 1.654f, 1.09f);// + new Vector3(user.transform.position.x, 0 , user.transform.position.z); //menu.transform.position = new Vector3(20.932f, 1.462f, 1.089f);// + new Vector3(user.transform.position.x, 0 , user.transform.position.z); menu.transform.position = viewCartUIlocation.transform.position; menu.transform.rotation = viewCartUIlocation.transform.rotation; menuUp = true; viewBag.SetActive(false); StartCoroutine(BringUp()); if (_StateManager.currentUserState == StateManager.UserState.examining) { _PileReturn.Act(); } _StateManager.currentUserState = StateManager.UserState.menu; } } else { if (!busy) { _StateManager.currentUserState = StateManager.UserState.browesing; StartCoroutine(BringUp()); viewBag.SetActive(true); menu.transform.position = new Vector3(0, -20, 0); menuUp = false; SlotClick.activeSlot = 100; } } }