Ejemplo n.º 1
0
 public BloodLineMember(IPopInstance pop)
 {
     this.PopInstance = pop;
     _parents         = new List <BloodLineMember>();
     _children        = new List <BloodLineMember>();
     _siblings        = new List <BloodLineMember>();
     _pastMates       = new List <BloodLineMember>();
 }
Ejemplo n.º 2
0
        public bool TryAddNewVillager(IPopInstance pop)
        {
            if (_population.ContainsKey(pop.InstanceId))
            {
                throw new Exception("Attemted to add duplicate villager " + pop.Label + " " + pop.InstanceId);
            }

            _population.Add(pop.InstanceId, pop);
            return(true);
        }
Ejemplo n.º 3
0
 public bool TryAddVillager(IPopInstance newGuy)
 {
     if (!this.PopulationManager.TryAddNewVillager(newGuy))
     {
         return(false);
     }
     if (newGuy is IJobWorker <JobDef> )
     {
         this.JobManager.TryRegisterNewWorker(newGuy as IJobWorker <JobDef>);
     }
     return(true);
 }
Ejemplo n.º 4
0
        public static BloodLineMember NewBloodlineMember(IEnumerable <BloodLineMember> parents, IPopInstance pop)
        {
            var newMember = new BloodLineMember(pop);

            foreach (var parent in parents)
            {
                newMember.AddParent(parent);
                parent.AddChild(newMember);

                foreach (var otherParent in parents.Where(x => x != parent))
                {
                    parent.AddPastMate(otherParent);
                }

                foreach (var child in parent.Children.Where(x => x != newMember))
                {
                    child.AddSibling(newMember);
                    newMember.AddSibling(child);
                }
            }
            return(newMember);
        }