예제 #1
0
    public void BuyBuilding(int nr)
    {
        if (stats.Get_Data_From("Free_Field") >= 1 && stats.Get_Data_From("Metal") >= MetalCost(nr) && stats.Get_Data_From("Crystal") >= CrystalCost(nr) && stats.Get_Data_From("Deuter") >= DeuterCost(nr))
        {
            SetPropertiesUp(nr);
            switch (nr)
            {
            case 0:
                stats.Set_Data("Metal_Mine", buildings[nr].level);
                stats.Set_Data("Income_Metal", buildings[nr].income * buildings[nr].level);
                break;

            case 1:
                stats.Set_Data("Crystal_Mine", buildings[nr].level);
                stats.Set_Data("Income_Crystal", buildings[nr].income * buildings[nr].level);
                break;

            case 2:
                stats.Set_Data("Deuter_Sintetizer", buildings[nr].level);
                stats.Set_Data("Income_Deuter", buildings[nr].income * buildings[nr].level);
                break;

            case 3:
                stats.Set_Data("Laboratory", buildings[nr].level);
                break;

            case 4:
                stats.Set_Data("Hangar", buildings[nr].level);
                break;

            case 5:
                stats.Set_Data("Metal_Store", buildings[nr].level);
                stats.Set_Data("Capacity_Metal", stats.Get_Data_From("Capacity_Metal") + buildings[nr].capacity);
                break;

            case 6:
                stats.Set_Data("Crystal_Store", buildings[nr].level);
                stats.Set_Data("Capacity_Crystal", stats.Get_Data_From("Capacity_Crystal") + buildings[nr].capacity);
                break;

            case 7:
                stats.Set_Data("Deuter_Store", buildings[nr].level);
                stats.Set_Data("Capacity_Deuter", stats.Get_Data_From("Capacity_Deuter") + buildings[nr].capacity);
                break;
            }
            SetFreeField(-1);
            ShowInformation(nr, "Bought!");
            GUIPlanetOperations.PlaySound_Complete();
        }
        else if (stats.Get_Data_From("Free_Field") >= 1 && (stats.Get_Data_From("Metal") < MetalCost(nr) || stats.Get_Data_From("Crystal") < CrystalCost(nr) || stats.Get_Data_From("Deuter") < DeuterCost(nr)))
        {
            GUIPlanetOperations.Turn_On_Ads("resources");
            ShowInformation(nr, "Earn!");
        }
    }
예제 #2
0
    private void SetTechnology(int nr)
    {
        switch (research[nr].name)
        {
        case "Combustion":
            stats.Set_Float_Data("Combustion", research[nr].level);
            break;

        default:
            stats.Set_Data(research[nr].name, research[nr].level);
            break;
        }
        PlayerPrefs.Save();
        ShowInformation(nr, "Bought!");
        GUIPlanetOperations.PlaySound_Complete();
    }
예제 #3
0
    private void SetStructures(int nr)
    {
        switch (structures[nr].name)
        {
        case "Space Base":
            stats.Set_Data("Space Base", structures[nr].level);
            break;

        case "Scout":
            stats.Set_Data("Scout", structures[nr].level);
            break;
        }
        PlayerPrefs.Save();
        ShowInformation(nr, "Bought!");
        GUIPlanetOperations.PlaySound_Complete();
    }