public static void Starved(Settler settler) { var contents = "{0}" + Console.Color(" starved today!", ConsoleColor.DarkRed); contents = string.Format(contents, Console.Color(settler.Name, SettlerColor)); EventManager.AddEvent(new Event(contents, EventType.SettlerStarved)); }
public static void Ate(Settler settler, Resource resource) { var contents = "{0} ate some {1}"; contents = string.Format(contents, Console.Color(settler.Name, SettlerColor), resource); EventManager.AddEvent(new Event(contents, EventType.SettlerAte)); }
public override void LoadContent(ContentManager content) { var map = Map; var platform = PlatformFactory.Get(EStructureType.Blank, ref mDirector, 3000, 3000); GameScreen.AddObject(platform); var platform2 = PlatformFactory.Get(EStructureType.Blank, ref mDirector, 3000, 2500); GameScreen.AddObject(platform2); var road = new Road(platform, platform2, ref mDirector); GameScreen.AddObject(road); var platform3 = PlatformFactory.Get(EStructureType.Blank, ref mDirector, 2700, 2700); GameScreen.AddObject(platform3); var road2 = new Road(platform2, platform3, ref mDirector); GameScreen.AddObject(road2); var road3 = new Road(platform, platform3, ref mDirector); GameScreen.AddObject(road3); var settler = new Settler(new Vector2(3000, 3200), Camera, ref mDirector, GameScreen, Ui); GameScreen.AddObject(settler); }
public void Setup(Settler settler, GameObject settlerScreen) { if (settler == null) { Debug.LogWarning("Settler cannot be null!"); return; } else if (settlerScreen == null) { Debug.LogWarning("SettlerScreen cannot be null!"); return; } if (s_count % 2 == 0) { gameObject.GetComponent <Image>().color = backgroundAColor; m_baseColor = backgroundAColor; } else { gameObject.GetComponent <Image>().color = backgroundBColor; m_baseColor = backgroundBColor; } m_settler = settler; name.text = settler.GetName(); settlerPortrait.sprite = M_SettlersManager.SGetPortrait(settler.GetPortraitId()); m_settlerScreen = settlerScreen; infoButton.onClick.AddListener(OnClickInfo); employButton.onClick.AddListener(OnClickEmploy); deemployButton.onClick.AddListener(OnClickDeemploy); s_count++; }
public static void Idle(Settler settler) { var contents = "{0} is idle today."; contents = string.Format(contents, Console.Color(settler.Name, SettlerColor)); EventManager.AddEvent(new Event(contents, EventType.SettlerIdle)); }
private void MoveSettler(Settler settler) { settler.Life--; if (settler.LastDirectionX != 0 || settler.LastDirectionY != 0) { var land = _world.Land.GetCell(settler.X + settler.LastDirectionX, settler.Y + settler.LastDirectionY); if (!IsWater(land)) { settler.X = land.X; settler.Y = land.Y; return; } } var potentialTilesSorted = _world.Land.GetNeumannNeighborsExclusive(settler.X, settler.Y) .Where(l => !IsWater(l)) .OrderBy(l => l.Food + l.Animals + l.MaxFood + l.MaxAnimals).ToArray(); var goal = Random.value < 0.5f ? potentialTilesSorted[0] : potentialTilesSorted[Random.Range(0, potentialTilesSorted.Length)]; settler.LastDirectionX = goal.X - settler.X; settler.LastDirectionY = goal.Y - settler.Y; settler.X = goal.X; settler.Y = goal.Y; }
public override void HostWork(Settler worker, Game game) { foreach (var(resource, amount) in Rates) { game.Settlement.AddResource(resource, amount); } }
public void UISelectSettler(Settler settler) { this.SelectedSettler = settler; settlerIP.gameObject.SetActive(true); settlerIP.AssignContent(settler); settlerIP.Draw(); }
public static void SAddEmployee(Settler settler) { if (s_instance != null) { s_instance.AddEmployee(settler); } }
public void AddDTO(PersonDTO personDTO) { var contacts = _unit.ContactsRepository.Get(); int maxContactID = contacts.Any() ? contacts.Max(x => x.ContactsId) : 0; var contact = _mapper.Map <Contact>(personDTO.Contacts); contact.ContactsId = maxContactID + 1; _unit.ContactsRepository.Add(contact); int maxPersonId = _unit.PersonsRepository.Get().Max(x => x.PersonId); var person = _mapper.Map <Person>(personDTO); person.PersonId = maxPersonId + 1; _unit.PersonsRepository.Add(person); var settler = new Settler { ContactId = contact.ContactsId, FlatArea = personDTO.FlatArea, FlatNumber = personDTO.FlatNumber, PersonId = person.PersonId }; _unit.SettlersRepository.Add(settler); _unit.Submit(); }
public static void Rehomed(Settler settler, ResidentialBuilding home) { var contents = "{0} moved into {1}"; contents = string.Format(contents, Console.Color(settler.Name, SettlerColor), home.Name); EventManager.AddEvent(new Event(contents, EventType.SettlerRehomed)); }
public static void Homeless(Settler settler) { var contents = "{0}" + Console.Color(" is homeless!", ConsoleColor.Red); contents = string.Format(contents, Console.Color(settler.Name, SettlerColor)); EventManager.AddEvent(new Event(contents, EventType.SettlerHomeless)); }
public static void Birthday(Settler settler) { var contents = "It's {0}'s birthday!"; contents = string.Format(contents, Console.Color(settler.Name, SettlerColor)); EventManager.AddEvent(new Event(contents, EventType.SettlerBirthday)); }
public void CreateCity() { EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; Entity entity = Settler.GetSelected(entityManager); SettlerActions.AddCommandCreateCity(entity); UISettlerPanel.Hide(); }
public static void GenerateTraits(Settler settler) { foreach (var trait in Trait.Traits) { settler.Traits[trait] = RandomUtil.WeightedGet(TraitLevel.TraitLevels, TraitLevel.Average, TraitLevel.Weight); } EnsureMajorTrait(settler); }
public RelationshipRole Role(Settler settler) { if (settler == Settler1) { return(Role1); } return(settler == Settler2 ? Role2 : null); }
public static void SkillIncreased(Settler settler, Skill skill) { var contents = "{0} became a {1} {2}"; contents = string.Format(contents, Console.Color(settler.Name, SettlerColor), Skill.LevelToString(skill.Level), Skill.AgentFromSkillType(skill.Type)); EventManager.AddEvent(new Event(contents, EventType.SettlerSkillIncrease)); }
public Settler Other(Settler settler) { if (settler == Settler1) { return(Settler2); } return(settler == Settler2 ? Settler1 : null); }
public static void EnsureMajorTrait(Settler settler) { //Always some major trait if (Trait.Traits.ToList().TrueForAll(trait => settler.Traits[trait] > TraitLevel.Low && settler.Traits[trait] < TraitLevel.High)) { settler.Traits[RandomUtil.Get(Trait.Traits)] = RandomUtil.Get(new[] { TraitLevel.VeryLow, TraitLevel.Low, TraitLevel.High, TraitLevel.VeryHigh }); } }
private void CreateSettlers(Tile goal) { int settlerCount = population / 4; Settler settler = new Settler(this, goal, settlerCount); population -= settlerCount; settlers.Add(settler); }
public void AddEmployee(Settler settler) { if (settler == m_employee) { m_employee = null; return; } m_employee = settler; RefreshUI(); }
public void AddSettler(Settler settler) { if (workingSettlers == null) { workingSettlers = new List <Settler>(); } workingSettlers.Add(settler); settler.GetEntity().MoveTo(GetHitpoint(settler.gameObject.transform.position), true); settler.CurrentBuilding = this; }
private MarriedRelationship(SettlerManager sm, int value, Settler partner1, Settler partner2) : base(sm, value, partner1, GetMarriedRole(partner1), partner2, GetMarriedRole(partner2)) { //Remove prior loverRelationship var loverRelationship = partner1.Relationships.FirstOrDefault(rel => rel is LoverRelationship love && love.Contains(partner2)); if (loverRelationship != null) { partner1.Relationships.Remove(loverRelationship); partner2.Relationships.Remove(loverRelationship); } }
protected Relationship(SettlerManager sm, int value, Settler settler1, RelationshipRole role1, Settler settler2, RelationshipRole role2) { Value = value; Settler1 = settler1; Role1 = role1; Settler2 = settler2; Role2 = role2; settler1.Relationships.Add(this); settler2.Relationships.Add(this); sm.Add(this); }
public override void LoadContent(ContentManager content) { //INGAME OBJECTS INITIALIZATION =================================================== //SetUnit var settler = new Settler(new Vector2(2900, 3200), Camera, ref mDirector, GameScreen, Ui); Camera.CenterOn(settler.AbsolutePosition); GameScreen.AddObject(settler); GameScreen.AddObject(new Puddle(new Vector2(3300, 2500), ref mDirector)); GameScreen.AddObject(new Puddle(new Vector2(4500, 2700), ref mDirector, false)); }
public static List <Settler> GetSiblings(Settler settler) { var siblings = new List <Settler>(); foreach (var relationship in settler.Relationships) { if (relationship is SiblingRelationship siblingRelationship) { siblings.Add(siblingRelationship.Other(settler)); } } return(siblings); }
private ParentChildRelationship(SettlerManager sm, int value, Settler parent, Settler child) : base(sm, value, parent, GetParentRole(parent), child, GetChildRole(child)) { //Add siblings var currentSiblings = SiblingRelationship.GetSiblings(child); var actualSiblings = GetChildren(parent).Where(c => c != child); foreach (var sibling in actualSiblings) { if (!currentSiblings.Contains(sibling)) { SiblingRelationship.Make(sm, 0, child, sibling); } } }
public static List <Settler> GetChildren(Settler settler) { var children = new List <Settler>(); foreach (var relationship in settler.Relationships) { if (relationship is ParentChildRelationship parentChildRelationship && parentChildRelationship.Role(settler) == Parent) { children.Add(parentChildRelationship.Other(settler)); } } return(children); }
public void Work(SettlersOfValgard game, Settler settler) { var table = Terrain.GatherTable; if (table == null || table.Count == 0) { //empty table VConsole.WriteWarning(settler + VConsole.Text(" is working on a barren ") + Terrain + VConsole.Text(" terrain!")); return; } var total = table.Aggregate(0, (prev, next) => next.Item2 + prev); var random = Noise.GetRecursiveNoise(game.Seed, game.Settlement.Day, settler.Id) % total; }
public static List <Settler> GetParents(Settler settler) { var parents = new List <Settler>(); foreach (var relationship in settler.Relationships) { if (relationship is ParentChildRelationship parentChildRelationship && parentChildRelationship.Role(settler) == Child) { parents.Add(parentChildRelationship.Other(settler)); } } return(parents); }