public void Grab() { activeObject = this.GetComponent <ObjectManager>().isActive[1]; if (_ObjectState.CanGrabOffShelf(activeObject)) // if you can grab the pointed at object grab it. { _PileGrab.Act(); _StateManager.ChangeUserState(StateManager.UserState.busy); } }
public void On() { // Callled from ObjectManager Class activeObject = this.GetComponent <ObjectManager>().isActive[1]; //finds what object is currently being looked at if (activeObject != null && activeObject.tag == ("TelButton")) { /* * print(_mapState.currentMapState.ToString()); * string nameOfTelButton = _mapState.currentMapState.ToString(); * * if (activeObject.tag == nameOfTelButton) // if pointing at telbutton that has already been tele. to * { * //do nothing. * } * else * { * highlighted = activeObject; * LeanTween.color(activeObject, Color.red, 0.1f); * //update state of map to equal string of * * _mapState.currentMapState = (enum)nameOfTelButton; * } */ //Check if mapstate equals telbutton state, if so, don't render highlighted = activeObject; LeanTween.color(activeObject, Color.red, 0.1f); } if (_ObjectState.CanGrabOffShelf(activeObject)) // if pointing at an object that can be picked up, turn it green { highlighted = activeObject; LeanTween.color(activeObject, Color.green, 0.1f); if (activeObject.tag == ("Storage")) { highlighted = activeObject; LeanTween.color(activeObject, Color.green, 0.1f); } } if (activeObject != null && activeObject.tag == ("Storage")) { highlighted = activeObject; LeanTween.color(activeObject, Color.green, 0.1f); } }
void Update() { // Get active object from ObjectManager, this is the object under the lazer pointer activeObject = this.GetComponent <ObjectManager>().isActive[1]; // if browesing then idle UI should be at the wall and all Fruit screens should be in storage if (_StateManager.currentUserState == StateManager.UserState.browesing) { if (_ObjectState.CanGrabOffShelf(activeObject)) { //idleUI.transform.position = uiStorage; //activeObject.GetComponent < IFruit > ().ScreenDisplay(inFront); } else { idleUI.transform.position = wall; if (IFruit.displayedScreenUI != null) { IFruit.TurnScreenOff(uiStorage); } } } // if examining then the idle UI should be in storage and the Fruit screen of the held object should be displayed else if (_StateManager.currentUserState == StateManager.UserState.examining) { _ObjectManager.heldObject.GetComponent <IFruit>().ScreenDisplay(inFront, screenRotation); //idleUI.transform.position = uiStorage; // Enable to hide screen UI when examining a fruit } else if (_StateManager.currentUserState == StateManager.UserState.busy) { } }