Exemple #1
0
 public void BuildingProcess(Image image, Text buildTime, AbstractBuild build)//подготовка к строительству
 {
     building_Under_Construction = build;
     current_icon = image.sprite;
     GetComponent <Image>().sprite = current_icon;
     BuildingTime = int.Parse(buildTime.text);
     StartCoroutine(BuildCoroutine());//постройка
 }
Exemple #2
0
 public void ShowInfo(AbstractBuild build)
 {
     //при нажатие на иконку здания в магазине показываются его характеристики
     Level.text   = build.Lvl.ToString();
     price.text   = build.Price.ToString();
     buildT.text  = build.Build_time.ToString();
     perform.text = build.Performance.ToString();
 }
Exemple #3
0
    void Resource_request(AbstractBuild build)
    {
        Gas            gas            = build as Gas;
        minerals       minerals       = build as minerals;
        gas_silos      gas_Silos      = build as gas_silos;
        minerals_silos minerals_Silos = build as minerals_silos;

        //проверка ресурсов в зависимости от типа постройки

        if (gas)
        {
            if (int.Parse(resourses._mineralsValue.text) >= int.Parse(ShopInfo.price.text) & !build_Panel.IsBuilding)//ресурсов достаточно
            {
                resourses.Set_Minerals(-int.Parse(ShopInfo.price.text));
                startBuild(Gas_.GetComponent <Image>(), ShopInfo.buildT, selectedBuild);
            }
            else if (!(int.Parse(resourses._mineralsValue.text) >= int.Parse(ShopInfo.price.text)))//если нет ресурсов
            {
                AlertText.fontSize = 18;
                AlertText.text     = "Not enough resources!!!";
                StartCoroutine("ShowAlert");
            }
            else if (build_Panel.IsBuilding)//если уже что то строится
            {
                AlertText.fontSize = 20;
                AlertText.text     = "Building Process...";
                StartCoroutine("ShowAlert");
            }
        }


        if (gas_Silos)
        {
            if (int.Parse(resourses._mineralsValue.text) >= int.Parse(ShopInfo.price.text) & build_Panel.IsBuilding != true)
            {
                resourses.Set_Minerals(-int.Parse(ShopInfo.price.text));
                startBuild(gasSilos_.GetComponent <Image>(), ShopInfo.buildT, selectedBuild);
            }
            else if (!(int.Parse(resourses._mineralsValue.text) >= int.Parse(ShopInfo.price.text)))
            {
                AlertText.fontSize = 18;
                AlertText.text     = "Not enough resources!!!";
                StartCoroutine("ShowAlert");
            }
            else if (build_Panel.IsBuilding)
            {
                AlertText.fontSize = 20;
                AlertText.text     = "Building Process...";
                StartCoroutine("ShowAlert");
            }
        }


        if (minerals)
        {
            if (int.Parse(resourses._gasValue.text) >= int.Parse(ShopInfo.price.text) & build_Panel.IsBuilding != true)
            {
                resourses.Set_Gas(-int.Parse(ShopInfo.price.text));
                startBuild(minShop.GetComponent <Image>(), ShopInfo.buildT, selectedBuild);
            }
            else if (!(int.Parse(resourses._gasValue.text) >= int.Parse(ShopInfo.price.text)))
            {
                AlertText.fontSize = 18;
                AlertText.text     = "Not enough resources!!!";
                StartCoroutine("ShowAlert");
            }
            else if (build_Panel.IsBuilding)
            {
                AlertText.fontSize = 20;
                AlertText.text     = "Building Process...";
                StartCoroutine("ShowAlert");
            }
        }

        if (minerals_Silos)
        {
            if (int.Parse(resourses._gasValue.text) >= int.Parse(ShopInfo.price.text) & !build_Panel.IsBuilding)
            {
                resourses.Set_Gas(-int.Parse(ShopInfo.price.text));
                startBuild(mineralsSilos_.GetComponent <Image>(), ShopInfo.buildT, selectedBuild);
            }
            else if (!(int.Parse(resourses._gasValue.text) >= int.Parse(ShopInfo.price.text)))
            {
                AlertText.fontSize = 18;
                AlertText.text     = "Not enough resources!!!";
                StartCoroutine("ShowAlert");
            }
            else if (build_Panel.IsBuilding)
            {
                AlertText.fontSize = 20;
                AlertText.text     = "Building Process...";
                StartCoroutine("ShowAlert");
            }
        }
    }
Exemple #4
0
 //выбранное в магазине здание
 void Select_Build(AbstractBuild build)
 {
     selectedBuild = build;
 }
Exemple #5
0
 void PawnGhost(AbstractBuild build)//павн указки
 {
     GetComponent <Image>().color = Color.green;
     isReady = true;
 }