コード例 #1
0
        void ConfigureExplorationBar(CityBuildingModel model)
        {
            if (model.IsExplored)
            {
                ExploredBar.MaxValue = Mathf.Max(model.RequiredExploreStages, 1);
                ExploredBar.Value = Mathf.Max(model.StagesExplored, 1);
            }
            else
            {
                ExploredBar.MaxValue = model.RequiredExploreStages;
                ExploredBar.Value = model.StagesExplored;

                if (model.AssignedSurvivors.Count > 0)
                {
                    ExploredBar.PreviewValue = model.AssignedSurvivors.Count;
                }
                else
                {
                    ExploredBar.PreviewValue = 0;
                }
            }


            ExploredBar.ForceUpdate();

            SecuredText.gameObject.SetActive(model.IsExplored);
        }
コード例 #2
0
 void OnZoomToTarget(ZoomToTargetEvent e)
 {
     if (e.Survivor != null)
     {
         CityBuildingModel target = e.Survivor.AssignedBuilding != null ? e.Survivor.AssignedBuilding : CityBuildingModel.CurrentBase;
         animationTarget = target.transform;
     }
 }
コード例 #3
0
        void DropOnBuilding()
        {
            CityBuildingModel hoveredBuilding = CityRaycaster.GetHoveredBuilding();

            if (hoveredBuilding != null && !(hoveredBuilding.IsExplored && !hoveredBuilding.OccupiableAfterSecuring))
            {
                Model.AssignToBuilding(hoveredBuilding);
                UpdateView();
            }
        }
コード例 #4
0
        void ConfigureDangerText(CityBuildingModel model)
        {
            if (model.IsExplored)
            {
                DangerLabel.text = "-";
                return;
            }

            DangerLabel.text = GetLimitString(model.GetDangerLevel(), DANGER_LIMITS);
        }
コード例 #5
0
        private void Awake()
        {
            LinkedModel = GetComponent <CityBuildingModel>();

            AssignedSurvivorsParent = Instantiate(PrefabDictionary.Singleton.SurvivorAssignParentPrefab, UIManager.Singleton.SurvivorAssignParent).transform;
            AssignedSurvivorsParent.GetComponent <SurvivorAssignmentParent>().CityBuilding = this;

            EventSystem.Subscribe <CityBuildingHoverEvent>(OnCityBuildingHovered, this);

            UpdateOutlineColor(false);
        }
コード例 #6
0
        void OnCityBuildingHovered(CityBuildingHoverEvent e)
        {
            if (currentModel == null)
            {
                return;
            }

            CityBuildingModel cityBuilding = e.Building;

            if (cityBuilding == null)
            {
                cityBuilding = currentModel.AssignedBuilding;
            }

            ConfigureAndShowForModel(currentModel, cityBuilding);
        }
コード例 #7
0
        public void InitialiseNew()
        {
            List <CityBuildingModel> createdModels = new List <CityBuildingModel>();

            foreach (CityBuildingSpawnSlot spawnSlot in SpawnSlots)
            {
                CityBuildingModel model = Instantiate(PrefabDictionary.GetRandomBuildingModelForSpawnSlot(spawnSlot).gameObject, transform).GetComponent <CityBuildingModel>();
                model.RandomizeProperties();
                model.RandomizeDanger();

                model.transform.position = model.Location = spawnSlot.transform.position;
                model.transform.rotation = model.Rotation = spawnSlot.transform.rotation;

                createdModels.Add(model);
            }

            BuildingModels = createdModels.ToArray();
        }
コード例 #8
0
        void ConfigureForBuilding(CityBuildingModel model)
        {
            currentModel = model;

            if (model == null)
            {
                Fader.FadeOut();
                return;
            }

            Title.text = model.Name;

            ConfigureDangerText(model);
            ConfigureFoodText(model);
            ConfigureMaterialsText(model);
            ConfigureExplorationBar(model);

            Fader.FadeIn();
        }
コード例 #9
0
        void ConfigureAndShowForModel(SurvivorModel model, CityBuildingModel building)
        {
            currentModel = model;

            CityBuildingStatModifiers statModifiers = new CityBuildingStatModifiers();

            if (building == null)
            {
                statModifiers = CityBuildingModel.CurrentBase.StatModifiers;
            }
            else if (!building.IsExplored)
            {
                statModifiers = CityBuildingModel.ScavengingModifiers;
            }
            else if (building.IsExplored)
            {
                statModifiers = building.StatModifiers;
            }

            SurvivorName.text = model.Name;
            ShootingBar.ConfigureForModel(model, model.ShootingSkill, statModifiers.ShootingChange);
            FitnessBar.ConfigureForModel(model, model.FitnessSkill, statModifiers.FitnessChange);
            StrengthBar.ConfigureForModel(model, model.StrengthSkill, statModifiers.StrengthChange);

            HungerBar.MaxValue     = SurvivorModel.MAX_HUNGER;
            HungerBar.Value        = model.Hunger;
            HungerBar.PreviewValue = 1;
            HungerBar.ForceUpdate();

            TirednessBar.MaxValue     = SurvivorModel.MAX_TIREDNESS;
            TirednessBar.Value        = Mathf.Min(model.Tiredness, model.Tiredness + statModifiers.TirednessChange);
            TirednessBar.PreviewValue = Mathf.Abs(statModifiers.TirednessChange);
            TirednessBar.ForceUpdate();

            Fader.FadeIn();
        }
コード例 #10
0
 public CityBuildingHoverEvent(CityBuildingModel building)
 {
     Building = building;
 }
コード例 #11
0
 public SurvivorAssignmentUpdatedEvent(SurvivorModel survivorModel, CityBuildingModel cityBuilding, bool added)
 {
     SurvivorModel = survivorModel;
     CityBuilding  = cityBuilding;
     Added         = added;
 }
コード例 #12
0
 void ConfigureMaterialsText(CityBuildingModel model)
 {
     BuildingResourcesLabel.text = GetLimitString(model.GetBuildingMaterialsRemaining(), RESOURCE_LIMITS);
 }
コード例 #13
0
 void ConfigureFoodText(CityBuildingModel model)
 {
     FoodLabel.text = GetLimitString(model.GetFoodRemaining(), RESOURCE_LIMITS);
 }
コード例 #14
0
 private void Awake()
 {
     EventSystem.Subscribe((NewGameEvent e) => { currentModel = null; }, this);
     EventSystem.Subscribe<CityBuildingHoverEvent>(OnCityBuildingHovered, this);
     EventSystem.Subscribe<SurvivorAssignmentUpdatedEvent>(OnSurvivorAssignmentUpdated, this);
 }