Exemplo n.º 1
0
    public void Produce()
    {
        if (GameManager.instance.gameState == GameManager.GameState.Default)
        {
            if (hasEnoughEnergy)
            {
                if (!LevelManager.instance.currentLevelFinished && productionCooldownElapsed)
                {
                    foreach (var productionUnit in production)
                    {
                        ResourcesManager.ResourceType rType = productionUnit.resourceType;
                        int amount = productionUnit.amount;
                        // int amount = Mathf.FloorToInt(productionUnit.amount * productionFactor);


                        ResourcesManager.instance.ProduceResource(rType, amount);
                    }

                    StartCoroutine("StartProductionCoolDown", this);

                    //ShopPanel.instance.UpdateShopItems();
                }
                else
                {
                    //Debug.Log("Mine | Production CoolDown not elapsed...");
                }
            }
            else
            {
                //Debug.Log("Mine can't produce, energy requirement isn't met !");
            }
        }
    }
Exemplo n.º 2
0
 public void SetParameters(ResourcesManager.ResourceType resource)
 {
     resourceNameText.text        = resource.resourceName;
     resourceValueText.text       = resource.startAmount.ToString();
     GetComponent <Image>().color = resource.color;
     resourceImage.GetComponent <Image>().sprite = resource.resourceImage;
 }
Exemplo n.º 3
0
    public void SetInfo(ResourcesManager.ResourceAmount resourceAmount)
    {
        resourceType  = resourceAmount.resourceType;
        costAmount    = resourceAmount.amount;
        resourceType  = resourceAmount.resourceType;
        resourceImage = resourceAmount.resourceType.resourceImage;

        SetCostAmount();
        SetResourceImage();
        UpdateResourceAvailabilityIndicator();
    }