public void ShowPackageInfoScreen(int packageIdx)
    {
        packageIdx--;
        if (packageIdx >= 0 && packageIdx < packages.Count)
        {
            chosenPackage = packages[packageIdx];
        }
        else
        {
            return;
        }

        Text[] textFields = packageInfoScreen.GetComponentsInChildren <Text>();
        textFields[0].text = chosenPackage.title;
        textFields[1].text = chosenPackage.description;
        moneyResVal.text   = chosenPackage.resources[typeof(MoneyResource)] + " EUR";
        timeResVal.text    = chosenPackage.days + (chosenPackage.days > 1 ? " Tage" : " Tag");
        co2ResVal.text     = chosenPackage.resources[typeof(CO2Resource)] + "g";
        cultureResVal.text = chosenPackage.culturePoints.ToString();

        Button [] buttons = packageInfoScreen.GetComponentsInChildren <Button>();

        if (PlayerResourceCalculator.EnoughForPackage(chosenPackage))
        {
            buttons[1].interactable = true;
        }
        else
        {
            buttons[1].interactable = false;
        }

        inCity.ToPackageInfoScreen();
    }
Exemple #2
0
    public static List <TransportOption> GetValidTransportOptions(City currentCity, string to)
    {
        List <TransportOption> options = new List <TransportOption>();
        City toCity = GetCity(to);

        foreach (TransportOption option in cityConnections)
        {
            if (option.From == currentCity && option.To == toCity && PlayerResourceCalculator.EnoughForTransportOption(option))
            {
                options.Add(option);
            }
        }
        return(options);
    }
Exemple #3
0
    public static List <string> GetTransportTypes(City currentCity, string to)
    {
        List <string> types  = new List <string>();
        City          toCity = GetCity(to);

        foreach (TransportOption option in cityConnections)
        {
            if (option.From == currentCity && option.To == toCity && PlayerResourceCalculator.EnoughForTransportOption(option))
            {
                types.Add(option.TransportType.Name);
            }
        }
        return(types);
    }
Exemple #4
0
    public static List <string> GetCityOptions(City currentCity)
    {
        List <string> cities = new List <string>();

        foreach (TransportOption option in cityConnections)
        {
            if (option.From == currentCity && !cities.Contains(option.To.Name))
            {
                if (PlayerResourceCalculator.EnoughForTransportOption(option))
                {
                    cities.Add(option.To.Name);
                }
            }
        }
        return(cities);
    }
    private void SetupPackagesButton()
    {
        bool hasValidOptions = false;

        for (int pIdx = 0; pIdx < packageObjects.Count; pIdx++)
        {
            Button btn = packageObjects[pIdx].GetComponentInChildren <Button>();
            if (PlayerResourceCalculator.EnoughForPackage(packages[pIdx]))
            {
                btn.interactable = true;
                hasValidOptions  = true;
            }
            else
            {
                btn.interactable = false;
            }
        }

        if (!hasValidOptions)
        {
            GameManager.Instance.GameOver();
        }
    }
Exemple #6
0
    public void AddCityStayInCurrent(SightseeingPackage package)
    {
        City city = GameManager.Instance.Player.Trip.CurrentCity;

        if (PlayerResourceCalculator.EnoughForCityStay(city, package.days))
        {
            GameManager.Instance.Player.AddCityStayWithPkg(city, package);

            if (MobileOnlyActivator.IsMobile)
            {
                ClosePackageInfoScreen();
            }

            else
            {
                DisplayCityChoiceScreen();
                UpdateCity();
            }
        }
        else
        {
            GameManager.Instance.SetErrorMessage(ErrorMessageType.ResourcesError, "not enough resources");
        }
    }