public void Prime(ItemClass item) { this.Item = item; textName.text = item.GetItemName(); //if (ItemSprite != null) // ItemSprite.sprite = item.sprite; ItemPrice.text = "$" + item.GetGoldCost(); if (item.GetItemType() == ItemSlot.WEAPON) { SpriteToSet.GetComponent <Image>().sprite = WpnSprite; } if (item.GetItemType() == ItemSlot.SHIELDS) { SpriteToSet.GetComponent <Image>().sprite = ShldSprite; } if (item.GetItemType() == ItemSlot.ENGINES) { SpriteToSet.GetComponent <Image>().sprite = EngineSprite; } if (item.GetItemType() == ItemSlot.ARMOR) { SpriteToSet.GetComponent <Image>().sprite = ArmorSprite; } if (item.GetItemType() == ItemSlot.MISC) { SpriteToSet.GetComponent <Image>().sprite = PowerSprite; } //ItemDescription.text = item.GetItemDesc(); }
public void AttemptToPurchase(ItemClass CurrentlySelectedItem) { PlayerCharacterSheet CurrentPlayer = PlayerStorage.GetComponent <PlayerBuyingEquipment>().GetPlayer(); //ItemClass CurrentlySelectedItem = ItemClass.GetItem(ItemSlot.WEAPON, 3); ItemClass OldItem = CurrentPlayer.GetItem(CurrentlySelectedItem.GetItemType()); DescriptionTextBox.text = CurrentlySelectedItem.GetItemDesc(); TransactionDetails.text = "Purchase Price $" + CurrentlySelectedItem.GetGoldCost() + ", Trade in Value $" + OldItem.GetGoldCost() + ", \nNet Purchase price $" + (CurrentlySelectedItem.GetGoldCost() - OldItem.GetGoldCost()); if (CurrentlySelectedItem.GetGoldCost() > (CurrentPlayer.Gold + OldItem.GetGoldCost())) { ErrorTextBox.text = "Error, not enough funds."; return; } CurrentPlayer.Gold = CurrentPlayer.Gold - (CurrentlySelectedItem.GetGoldCost() - OldItem.GetGoldCost()); CurrentPlayer.AddEquipment(CurrentlySelectedItem); CurrentFundsBox.text = "Current Funds $" + CurrentPlayer.Gold; PlayerCharacterSheet.SaveToDisk(CurrentPlayer, CharacterSheetLocation); PlayerStorage.GetComponent <PlayerBuyingEquipment>().UpdateRequired(); WeaponEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment(); ArmorEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment(); ShieldEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment(); PowerEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment(); EnginesEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment(); }
internal void AddEquipment(ItemClass currentlySelectedItem) { if (currentlySelectedItem.GetItemType() == ItemSlot.WEAPON) { this.WeaponEquippedID = currentlySelectedItem.GetItemId(); } if (currentlySelectedItem.GetItemType() == ItemSlot.SHIELDS) { this.ShieldEquippedID = currentlySelectedItem.GetItemId(); } if (currentlySelectedItem.GetItemType() == ItemSlot.ARMOR) { this.ArmorEquippedID = currentlySelectedItem.GetItemId(); } if (currentlySelectedItem.GetItemType() == ItemSlot.ENGINES) { this.EngineEquippedID = currentlySelectedItem.GetItemId(); } if (currentlySelectedItem.GetItemType() == ItemSlot.MISC) { this.MiscEquippedID = currentlySelectedItem.GetItemId(); } }