Пример #1
0
        //TODO Maybe turn this into an event
        public void MonthlyTick()
        {
            // ReSharper disable once ForCanBeConvertedToForeach
            for (var index = 0; index < _activeUpgradedCultivations.Count; index++)
            {
                var upgrade           = _activeUpgradedCultivations[index];
                var cultivationPrefab = upgrade.MyCultivationPrefab;
                cultivationPrefab.UpgradeDuration--;
                if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Farm)
                {
                    ((BuildingPrefab)cultivationPrefab).MyBuilding.UpgradeDuration = cultivationPrefab.UpgradeDuration;
                }
                else if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Field)
                {
                    ((PlantPrefab)cultivationPrefab).MyPlant.UpgradeDuration = cultivationPrefab.UpgradeDuration;
                }

                if (cultivationPrefab.UpgradeDuration >= 1)
                {
                    continue;
                }
                if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Farm)
                {
                    Debug.Log("Building type = buidling prefab");
                    BuildingPlacement.UpgradeFarmFinished((BuildingPrefab)cultivationPrefab);
                    MySidePanel.SetPanel(((BuildingPrefab)cultivationPrefab).MyBuilding);
                    RemoveUpgradedCultivation(cultivationPrefab);
                }
                else if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Field)
                {
                    BuildingPlacement.UpgradeFieldFinished((PlantPrefab)cultivationPrefab);
                    MySidePanel.SetPanel(((PlantPrefab)cultivationPrefab).MyPlant);
                    RemoveUpgradedCultivation(cultivationPrefab);

                    Debug.Log("Building type = plant prefab");
                }
                else
                {
                    Debug.LogError("Type not found");
                }
            }
        }
Пример #2
0
 public void SetSidePanel(Cultivation cultivation)
 {
     MySidePanel.SetPanel(cultivation);
 }