Example #1
0
 public void TechButtonMouseEnter(TechCostData costToCheck) // Display the required resources for constructing the tech button the mouse entered
 {
     for (int i = 0; i < costToCheck.cost.Length; i++)      // assign cost values
     {
         techSupplyCosts[i].text = costToCheck.cost[i].ToString();
         if (costToCheck.cost[i] == 0)
         {
             techSupplyCostLabels[i].SetActive(false); // disable tech cost label if cost is 0
         }
     }
     techName.text        = "Upgrade Name: " + costToCheck.techName;
     techDescription.text = "Description: " + costToCheck.description;
 }
Example #2
0
    private bool ResourceRequirementsMet(TechCostData techData) // helper function for UpdateTechButtons; compare tech cost to player inventory
    {
        int[] suppliesInInventory = MainManager.Inventory.GetSupplies();

        for (int i = 0; i < Enum.GetNames(typeof(Supplies)).Length; i++)
        {
            if (suppliesInInventory[i] < techData.cost[i])
            {
                return(false); // returns false if even a single resource requirment is not met
            }
        }

        return(true); // returns true if all resource requirements are met
    }