Exemplo n.º 1
0
    public bool ChoiceStockPile()
    {
        float countFree = 0;

        foreach (GameObject o in _village.Building)
        {
            StockPile stocks = o.GetComponent <StockPile>();
            if (stocks != null)
            {
                Inventory inv = stocks.GetComponent <Inventory>();
                countFree += inv.MaxWeight - inv.Weight;
            }
        }
        return(countFree < 100f);
    }
Exemplo n.º 2
0
    public bool NoBuildNeeded()
    {
        bool need = true;

        foreach (GameObject o in _village.Building)
        {
            House house = o.GetComponent <House>();
            if (house != null && house.Villagers.Length < house.MaxCount)
            {
                need = false;
            }
        }
        if (need)
        {
            return(false);
        }
        int consomation = (int)(_village.Villagers.Length *
                                (
                                    (float)Manager.Instance.Properties.GetElement("Agent.Hunger").Value /
                                    (float)Manager.Instance.Properties.GetElement("Delay.Hungry").Value
                                ) * (float)Manager.Instance.Properties.GetElement("Delay.Season").Value * 5f);
        int   count = _village.GetComponentsInChildren <Cornfield>().Length;
        int   cornfieldProduction = (int)(float)Manager.Instance.Properties.GetElement("Harvest.Cornfield").Value;
        float cornfieldDuration   = (float)Manager.Instance.Properties.GetElement("Delay.Cornfield.Seeding").Value +
                                    (float)Manager.Instance.Properties.GetElement("Delay.Cornfield.Growing").Value +
                                    (float)Manager.Instance.Properties.GetElement("Delay.Cornfield.Harvest").Value;
        int production = (int)(Manager.Instance.SeasonDuration * 3f / cornfieldDuration) * count * cornfieldProduction *
                         (int)(float)Manager.Instance.Properties.GetElement("FoodValue.Corn").Value;

        if (consomation > production)
        {
            return(false);
        }
        float countFree = 0;

        foreach (GameObject o in _village.Building)
        {
            StockPile stocks = o.GetComponent <StockPile>();
            if (stocks != null)
            {
                Inventory inv = stocks.GetComponent <Inventory>();
                countFree += inv.MaxWeight - inv.Weight;
            }
        }
        return(countFree > 100f);
    }