Exemple #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (currentTick % tickRate == 0)
        {
            food += farm.CalculateEfficiency() * 0.5f;

            float foodConsumption = 0f;
            foreach (Worker worker in workerIndex.GetAllWorkers())
            {
                food -= worker.foodConsumption;
                if (food < 0)
                {
                    food = 0;
                }
                foodConsumption += worker.foodConsumption;
            }
            totalFoodConsumption = foodConsumption;
            Notify(this);

            currentTick = 0;
        }
        currentTick++;
    }