public void consumeObject()
{
if((isQuant ==false) || ((isQuant) && (Link==1)) || (isEnchanted==true))
{//the last of the item or is not a quantity;
Container cn = GameWorldController.instance.playerUW.playerInventory.GetCurrentContainer();
//Code for objects that get destroyed when they are used. Eg food, potion, fuel etc
if (!cn.RemoveItemFromContainer(this.name))
{//Try and remove from the paperdoll if not found in the current container.
GameWorldController.instance.playerUW.playerInventory.RemoveItemFromEquipment(this.name);
}
if (GameWorldController.instance.playerUW.playerInventory.ObjectInHand==this.name)
{
GameWorldController.instance.playerUW.playerInventory.ObjectInHand="";//Make sure there is not instance of this object in the players hand
UWHUD.instance.CursorIcon= UWHUD.instance.CursorIconDefault;
}
GameWorldController.instance.playerUW.playerInventory.Refresh();
Destroy (this.gameObject);
}
else
{//just decrement the quantity value;
Link--;
ObjectInteraction.Split (this);
GameWorldController.instance.playerUW.playerInventory.Refresh();
}
}
public override bool ActivateByObject(ObjectInteraction ObjectUsed) { //ObjectInteraction objI=ObjectUsed.GetComponent<ObjectInteraction>(); if (ObjectUsed != null) { if (ObjectUsed.GetItemType() == ObjectInteraction.A_BLACKROCK_GEM) { if (ObjectUsed.owner == 1) { int thisGemIndex = ObjectUsed.item_id - 280; int bitField = (1 << thisGemIndex); Quest.instance.x_clocks[2]++; Quest.instance.QuestVariables[130] |= bitField; UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338)); UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338 + Quest.instance.x_clocks[2])); CameraShake.instance.ShakeEarthQuake(Quest.instance.x_clocks[2] * 0.2f); ObjectUsed.consumeObject(); } else { UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 347)); } CurrentObjectInHand = null; return(true); } } return(false); }