public void searchThroughInventory() { ////////Debug.Log ("Searching through inventory"); Inventory i = personToFind.GetComponent <Inventory> (); PortableContainerItem pt = personToFind.GetComponentInChildren <PortableContainerItem> (); foreach (Item it in i.inventoryItems) { if (it.illigal == true) { personHadIlligalItem = true; } } if (pt == null) { } else { foreach (Item it in pt.myContainer.itemsInContainer) { if (it.illigal == true) { personHadIlligalItem = true; } } } OnComplete(); }
void decideWhatToDoWithObject() { if (target == null) { confiscate = false; falseAlarm = true; } else if (target.gameObject.tag == "NPC" || target.gameObject.tag == "Player") { confiscate = false; //not sure what to do with this } else if (target.GetComponent <Item> () == true) { if (target.GetComponent <ThrowableItem> () == true) { falseAlarm = true; myController.memory.raiseAlarm = true; } else if (target.gameObject.GetComponent <Weapon> () == true || target.gameObject.GetComponent <AmmoItem> () == true || target.gameObject.GetComponent <HighValueItem> () == true) { //found an item that should set off the alarm, falseAlarm = false; confiscate = true; //myController.npcB.doing = whatAiIsDoing.raisingAlarm; } else if (target.gameObject.GetComponent <PortableContainerItem> () == true) { PortableContainerItem pc = target.GetComponent <PortableContainerItem> (); foreach (Item i in pc.myContainer.itemsInContainer) { if (i.gameObject.GetComponent <Weapon> () == true || i.gameObject.GetComponent <AmmoItem> () == true || i.gameObject.GetComponent <HighValueItem> () == true) { //found an item in a container that should set off the alarm, falseAlarm = false; confiscate = true; //myController.memory.raiseAlarm = true; //myController.npcB.doing = whatAiIsDoing.raisingAlarm; } } } else { confiscate = true; falseAlarm = true; } } else { confiscate = false; falseAlarm = true; } }
void isContainerDropped() { if (myItem == null) { } else { if (myItem.gameObject.activeInHierarchy == true) { myItem = null; } } }