//Precondition(s) that are not Prolog facts public override bool ProcedurePrecondition(GameObject agent) { int value = 0; //will try to steal most valuable item Item_GameObject mostVal = null; //Find all items in dungeon Item_GameObject[] items = (Item_GameObject[])UnityEngine.GameObject.FindObjectsOfType(typeof(Item_GameObject)); //Find most valuable item foreach (Item_GameObject item in items) { if (item.price > value) { mostVal = item; value = item.price; } } //set stealing target as most valuable item target = mostVal; //Returns false if no items in dungeon return(value != 0); }
void Awake() { // Grab the Item_GameObject script that is on this GameObject ig = GetComponent <Item_GameObject> (); // Set the GameObject to not be able to be picked up. ig.canPickUp = false; // Since this just spawned we make it non pickupable for a short time so the player can tell wtf this item actually is lol before grabbing it. StartCoroutine(TimeTillPickUp()); }