示例#1
0
 public void Disable(Receources rec)
 {
     if (rec == typeOfReceource)
     {
         this.enabled = false;
     }
 }
示例#2
0
    public void ChangeRec(Receources resouce)
    {
        var slider = GetComponentInChildren <Slider>();

        switch (resouce)
        {
        case Receources.SEEDS:
            rec          = Receources.SEEDS;
            slider.value = 0;
            changeValueTo(Receources.SEEDS);
            break;

        case Receources.WATER:
            rec          = Receources.WATER;
            slider.value = 0;
            changeValueTo(Receources.WATER);
            break;

        case Receources.MONEY:
            rec          = Receources.MONEY;
            slider.value = 0;
            changeValueTo(Receources.MONEY);
            break;
        }
    }
示例#3
0
 public void Enable(Receources rec)
 {
     if (rec == typeOfReceource)
     {
         this.enabled = true;
     }
 }
示例#4
0
    public void ChangeValueWhileProducing(Receources _rec, float value)
    {
        switch (_rec)
        {
        case Receources.SEEDS:
            seedsNumber = value;
            if (rec == Receources.SEEDS)
            {
                changeValueTo(Receources.SEEDS);
            }
            break;

        case Receources.WATER:
            waterNumber = value;
            if (rec == Receources.WATER)
            {
                changeValueTo(Receources.WATER);
            }
            break;

        case Receources.MONEY:
            moneyNumber = value;
            if (rec == Receources.MONEY)
            {
                changeValueTo(Receources.MONEY);
            }
            break;
        }
    }
    public void SendShip(Planet from, Planet to, Receources resource, int amount)
    {
        GameObject spaceShipRef = Instantiate(SpaceShipPrefab, from.transform.position, Quaternion.identity);

        spaceShipRef.GetComponent <SpaceShipController>()?.SetTargetPlanet(to);
        //spaceShipRef.GetComponent<PlanetReceources>()?.AddReceource(resource, amount);

        spaceShipRef.GetComponent <UnitResources>().AddResource(resource, amount);
    }
示例#6
0
 public Sprite GetImageOfType(Receources receources)
 {
     foreach (IndicatorPairs pair in ResourceImagePairs)
     {
         if (pair.resourceType == receources)
         {
             return(pair.image);
         }
     }
     return(null);
 }
示例#7
0
    public void ChangeTypeOfReceource(Receources rec)
    {
        switch (rec)
        {
        case Receources.SEEDS:
            typeOfReceurce = Receources.SEEDS;
            break;

        case Receources.WATER:
            typeOfReceurce = Receources.WATER;
            break;

        case Receources.MONEY:
            typeOfReceurce = Receources.MONEY;
            break;
        }
    }
示例#8
0
    public void ChangeTypeOfReceource(int i)
    {
        switch (i)
        {
        case 1:
            typeOfReceurce = Receources.SEEDS;
            break;

        case 2:
            typeOfReceurce = Receources.WATER;
            break;

        case 3:
            typeOfReceurce = Receources.MONEY;
            break;
        }
    }
示例#9
0
    void changeValueTo(Receources _rec)
    {
        var slider = GetComponentInChildren <Slider>();

        switch (_rec)
        {
        case Receources.SEEDS:
            slider.maxValue = seedsNumber;
            rec             = _rec;
            break;

        case Receources.WATER:
            slider.maxValue = waterNumber;
            rec             = _rec;
            break;

        case Receources.MONEY:
            slider.maxValue = moneyNumber;
            rec             = _rec;
            break;
        }
    }
    public void UpdateUpgradeText(Receources resource, string description, int price)
    {
        switch (resource)
        {
        case Receources.SEEDS:
            farmUpgradeDescription.text = description;
            var buttonPriceTextFarm = farmUpgradeButton.GetComponentInChildren <TextMeshProUGUI>();
            buttonPriceTextFarm.text = price.ToString();
            break;

        case Receources.WATER:
            waterUpgradeDescription.text = description;
            var buttonPriceTextWater = waterUpgradeButton.GetComponentInChildren <TextMeshProUGUI>();
            buttonPriceTextWater.text = price.ToString();
            break;

        case Receources.MONEY:
            mineUpgradeDescription.text = description;
            var buttonPriceTextMine = mineUpgradeButton.GetComponentInChildren <TextMeshProUGUI>();
            buttonPriceTextMine.text = price.ToString();
            break;
        }
    }
示例#11
0
    public void ChangeAmount(Receources rec, int amount)
    {
        switch (rec)
        {
        case Receources.SEEDS:
            seedsNumber = amount;
            seeds.text  = seedsNumber.ToString();
            Debug.Log("seedstext " + seeds.text);
            break;

        case Receources.WATER:

            waterNumber = amount;
            water.text  = waterNumber.ToString();

            break;

        case Receources.MONEY:
            moneyNumber = amount;
            money.text  = moneyNumber.ToString();
            break;
        }
    }
示例#12
0
 public void UpdateResourceButtons(Receources rec, int amount)
 {
     UIResouceButtons.GetComponent <ResourcesButtonsUpdater>().ChangeAmount(rec, amount);
     UITransportZone.GetComponentInChildren <ChangeMaxValue>().ChangeValueWhileProducing(rec, amount);
 }
示例#13
0
 public void UpdateUpgrades(Receources resource, string description, int price)
 {
     UIInvestmentZone.GetComponent <InvestmentZoneUpdater>().UpdateUpgradeText(resource, description, price);
 }
示例#14
0
 public void AddResource(Receources resourceType, int amount)
 {
     resources[resourceType] += amount;
 }