Example #1
0
        /// <inheritdoc/>
        public void PerformProduction()
        {
            if (ActiveProject == null)
            {
                return;
            }

            ActiveProject.Progress += ProductionLogic.GetProductionProgressPerTurnOnProject(this, ActiveProject);

            if (ActiveProject.Progress >= ActiveProject.ProductionToComplete)
            {
                ProductionResolver.MakeProductionRequest(ActiveProject, this);
                ActiveProject = null;
            }
        }
        private void DisplayProductionData()
        {
            int currentProgress  = ObjectToDisplay.ActiveProject.Progress;
            int productionNeeded = ObjectToDisplay.ActiveProject.ProductionToComplete;

            int turnsToProduce = Mathf.CeilToInt(
                (float)(productionNeeded - currentProgress) /
                ProductionLogic.GetProductionProgressPerTurnOnProject(ObjectToDisplay, ObjectToDisplay.ActiveProject)
                );

            TurnsUntilProductionFinishedField.text = turnsToProduce.ToString();

            ProductionSlider.minValue = 0;
            ProductionSlider.maxValue = productionNeeded;
            ProductionSlider.value    = currentProgress;
        }