// updates the actions according to what is hardSelected or softSelected private void actionUpdater() { //Debug.Log((global.hardSelected != null) + " " + (global.softSelected != null)); if (!setButtons) { guiActionObj.SetActive(true); if (global.hardSelected != null) { dynamicButtonUpdaterScript.receiveItemObject(global.hardSelected, global.itemInfo); global.softSelected = null; } else if (global.softSelected != null) { dynamicButtonUpdaterScript.receiveItemObject(global.softSelected, global.itemInfo); global.hardSelected = null; } else { dynamicButtonUpdaterScript.enableAllButtons(); dynamicButtonUpdaterScript.setStates(new bool[] { true, true, false, true }); guiActionObj.SetActive(false); global.itemInfo = null; holdingObject = false; } setButtons = true; } }
//Sets up the haunt/unhaunt actions buttons when initially looking at an object //Also stores the object and the implemented abstract ItemActionInterface // associated with that object /*public void prepForHaunt(GameObject item, ItemActionInterface itemInfo) * { * lastItemObject = item; * lastItemInterface = itemInfo; * myController.setItemInfo(myHauntActions); * * dynamicButtonUpdaterScript.receiveItemObject(gameObject, myHauntActions); * dynamicButtonUpdaterScript.setStates(myHauntActions.states); * } */ //This is called to progress down a tree of actions public void goFowardAHaunt(ItemActionInterface info) { //Debug.Log("before global item is: " + myGlobal.itemInfo ); previousMenus.Enqueue(myGlobal.itemInfo); //Debug.Log("new global item is " + info); myGlobal.itemInfo = info; dynamicButtonUpdaterScript.receiveItemObject(myGlobal.itemInfo.gameObject, info); //dynamicButtonUpdaterScript.setStates(info.states); }
private void clickCheck() { if (!global.possessing) { RaycastHit rayHit; Ray ray = cameraComponent.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out rayHit)) { GameObject other = rayHit.collider.gameObject; if (other.tag == "Item") { if (decalOpen) { decalStates = dynamicButtonUpdaterScript.getStates(); } ItemActionInterface tmp = other.GetComponent <ItemActionInterface>(); itemInfo = myHauntActions; //myHauntScript.prepForHaunt(other, tmp); decalOpen = false; } } else { if (!decalOpen) { selectorIcon.sprite = null; itemInfo = myDecalActions; dynamicButtonUpdaterScript.receiveItemObject(gameObject, myDecalActions); selectorText.text = "Decal"; //dynamicButtonUpdaterScript.setStates(decalStates); decalOpen = true; } } } }