Exemplo n.º 1
0
        private void Produce(IronProducer ironProducer, GiverComponent ironGiver, DwarfsSlots dwarfsSlots)
        {
            if (!ironProducer || !ironGiver || !dwarfsSlots)
            {
                return;
            }

            if (ironProducer.timeSinceLastProduction >=
                ironProducer.productionEveryXMinutes * FramesPerSecond * secondPerMinute ||
                ironGiver.amount < ironGiver.maxCapacity)
            {
                ironGiver.amount += (ironProducer.productionPerMinute * dwarfsSlots.dwarfsAlreadyIn);
                ironProducer.timeSinceLastProduction = 0;
            }
            else
            {
                ironProducer.timeSinceLastProduction++;
            }
        }
Exemplo n.º 2
0
        private void addNewMine(IronProducer ironProducer, GiverComponent ironGiver, DwarfsSlots dwarfsSlots)
        {
            IronProducer[]   tmpIronProducers = new IronProducer[ironProducers.Length + 1];
            GiverComponent[] tmpIronGivers    = new GiverComponent[ironGivers.Length + 1];
            DwarfsSlots[]    tmpDwarfsSlots   = new DwarfsSlots[workingSlots.Length + 1];

            for (int i = 0; i < ironProducers.Length; i++)
            {
                tmpIronProducers[i] = ironProducers[i];
                tmpIronGivers[i]    = ironGivers[i];
                tmpDwarfsSlots[i]   = workingSlots[i];
            }

            tmpIronProducers[tmpIronProducers.Length - 1] = ironProducer;
            tmpIronGivers[tmpIronProducers.Length - 1]    = ironGiver;
            tmpDwarfsSlots[tmpDwarfsSlots.Length - 1]     = dwarfsSlots;

            ironProducers = tmpIronProducers;
            ironGivers    = tmpIronGivers;
            workingSlots  = tmpDwarfsSlots;
        }