void Update () {
if(Input.GetButtonDown("Inventory") && canInventory){
canInventory = false;
StartCoroutine(InvTimer(1));
UseInventory();
}
}
void UseInventory(){
GameObject HudPanel = GameObject.Find("HudPanel");
GameObject InventoryPanel = GameObject.Find("InventoryPanel");
if(!inInventory){
Debug.Log("inInventory");
Screen.lockCursor = false;
NGUITools.SetActive(InventoryPanel,true);
//NGUITools.SetActive(HudPanel,false);
inInventory = true;
}
else if (inInventory){
Debug.Log("not inInventory");
Screen.lockCursor = true;
NGUITools.SetActive(InventoryPanel,false);
//NGUITools.SetActive(HudPanel,true);
inInventory = false;
}
}
public IEnumerator InvTimer(float delay){
yield return new WaitForSeconds
(delay
); canInventory = true;
}
}