示例#1
0
        public static RenderTexture RenderHeadshot(SurvivorModel model)
        {
            if (headshots.ContainsKey(model.Name))
            {
                return(headshots[model.Name]);
            }

            RenderTexture texture = new RenderTexture(HEADSHOT_IMAGE_SIZE, HEADSHOT_IMAGE_SIZE, 16);

            Singleton.RenderCam.targetTexture = texture;

            GameObject head = SurvivorAvatarGenerator.GenerateHeadAvatarForModel(model);

            head.transform.SetParent(Singleton.RenderCam.transform);
            head.transform.localPosition = HEADSHOT_OFFSET;
            head.transform.Rotate(0f, 180f, 0f);

            Singleton.Light.enabled = true;
            Singleton.RenderCam.Render();
            Singleton.RenderCam.targetTexture = null;
            Singleton.Light.enabled           = false;

            DestroyImmediate(head);

            headshots.Add(model.Name, texture);
            return(texture);
        }
示例#2
0
 void OnSurvivorIconUnhovered(SurvivorIconUnhoveredEvent e)
 {
     if (e.Icon.Model == currentModel)
     {
         currentModel = null;
         Hide(false);
     }
 }
        public void SetSurvivor(SurvivorModel model)
        {
            Survivor = model;

            if (model != null)
            {
                Headshots.texture = AvatarRenderCamera.RenderHeadshot(model);
            }
        }
        public static void GenerateHeroicSurvivorModel()
        {
            SurvivorModel model = new SurvivorModel();

            model.RandomiseValues();

            model.FitnessSkill  = Random.Range(HEROIC_SURVIVOR_STAT_MIN, GENERIC_SURVIVOR_STAT_VARIANCE + 1);
            model.StrengthSkill = Random.Range(HEROIC_SURVIVOR_STAT_MIN, HEROIC_SURVIVOR_STAT_MAX + 1);
            model.ShootingSkill = Random.Range(HEROIC_SURVIVOR_STAT_MIN, HEROIC_SURVIVOR_STAT_MAX + 1);
            model.Name          = SurvivorNameGenerator.GenerateName(model.IsMale);
        }
示例#5
0
        public void ConfigureForSurvivor(SurvivorModel s)
        {
            SurvivorName.text        = s.Name;
            SurvivorHeadshot.texture = AvatarRenderCamera.RenderHeadshot(s);
            //IconBackground.color = SurvivorAvatarGenerator.GetColorForRoom(s.AssignedBuilding); // TODO

            ConfigureStat(ref ShootingStatChange, s.ShootingChange, false);
            ConfigureStat(ref FitnessStatChange, s.FitnessChange, false);
            ConfigureStat(ref StrengthStatChange, s.StrengthChange, false);
            ConfigureStat(ref TirednessStatChange, s.TirednessChange, true);
            ConfigureStat(ref HealthStatChange, s.HealthChange, true);
            ConfigureStat(ref HungerStatChange, s.HungerChange, true);
        }
示例#6
0
        private void OnNewGame(NewGameEvent e)
        {
            CityModel.CurrentCity = PrefabDictionary.GetRandomStartCity();
            // TODO: setup base

            SurvivorModel.Initialise();
            SurvivorGenerator.GenerateInitialSurvivors();

            Timer.CreateTimer(gameObject, 0.05f, () =>
            {
                EventSystem.Publish(new ModelsInitialisedEvent(false));
            });
        }
        void Unassign()
        {
            if (!GameStateController.IsInDayManagementState())
            {
                return;
            }

            if (Survivor == null)
            {
                return;
            }

            SurvivorModel replacedModel = Survivor;

            Survivor = null;
            replacedModel.AssignToBuilding(null);
        }
示例#8
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();
        }
示例#9
0
 public ZoomToTargetEvent(SurvivorModel survivor)
 {
     Survivor = survivor;
 }
 public SurvivorAssignmentUpdatedEvent(SurvivorModel survivorModel, CityBuildingModel cityBuilding, bool added)
 {
     SurvivorModel = survivorModel;
     CityBuilding  = cityBuilding;
     Added         = added;
 }