protected virtual bool EqualsInheritance(object obj) { if (obj == null || !(obj is WoodshopMaterial)) { return(false); } WoodshopMaterial otherGameMaterial = (WoodshopMaterial)obj; if (this.ID != otherGameMaterial.ID) { return(false); } if (this.Name != otherGameMaterial.Name) { return(false); } if (this.Type != otherGameMaterial.Type) { return(false); } if (this.Icon != otherGameMaterial.Icon) { return(false); } if (this.StorePrice != otherGameMaterial.StorePrice) { return(false); } return(true); }
void Awake() { //If data is not available, I default to the test data added through the Editor PlayerProfile p = PlayerProfileDatabase.Instance.currentProfile; if (p != null) { Inventory inventory = InventoryDatabase.Instance.GetInventoryByPlayer(p.ID); if (inventory != null) { PlayerInventory = new List <InventoryDataDisplay>(); foreach (float materialID in inventory.AvailableTools) { int amount = inventory.GetMaterialCount(materialID); WoodshopMaterial wm = MaterialsDatabase.Instance.RetrieveEntity(materialID); InventoryDataDisplay display = new InventoryDataDisplay { Name = wm.ToString(), Image = wm.Icon, Available = amount }; PlayerInventory.Add(display); } } } Initilize(PlayerInventory.Count - 1); UpdateDisplay(); }
public List <WoodshopMaterialCountData> CheckPlayerMaterials(Inventory playerInventory) { List <WoodshopMaterialCountData> availableMaterials = new List <WoodshopMaterialCountData>(); foreach (WoodshopMaterialCount wc in RequiredMaterials) { WoodshopMaterial wm = MaterialsDatabase.Instance.RetrieveEntity(wc.MaterialID); int amountAvailable = playerInventory.GetMaterialCount(wm.ID); availableMaterials.Add(new WoodshopMaterialCountData(wm, amountAvailable, wc.Amount)); } return(availableMaterials); }
public WoodshopMaterialCountData(WoodshopMaterial material, int available, int required) { this.WorkMaterial = material; this.AmountAvailable = available; this.AmountRequired = required; }