public bool Mate(Male mate) { mate.Mate(UT); interest.Mate(UT); var ot = cycle.OvulationTime; float fv = 0, mv = 0; if (UT < ot) { mv = mate.gamete.Viability(ot - UT); fv = gamete.Viability(0); } else { mv = mate.gamete.Viability(0); fv = gamete.Viability(ot - UT); } float conceive_chance = fv * mv; if (UnityEngine.Random.Range(0, 1f) > conceive_chance) { return(false); } embryo = new Embryo(this, mate); ProgenyScenario.current.AddEmbryo(embryo); return(true); }
void LoadZygotes(ConfigNode config) { var zygote_list = config.nodes; foreach (ConfigNode z in zygote_list) { switch (z.name) { case "embryo": var embryo = new Embryo(z); embryos[embryo.id] = embryo; break; case "juvenile": var juvenile = new Juvenile(z); juveniles[juvenile.id] = juvenile; break; case "female": var female = new Female(z); females[female.id] = female; break; case "male": var male = new Male(z); males[male.id] = male; break; } } }
void initialize() { lastUpdate = Planetarium.GetUniversalTime(); fsm = new FemaleFSM(this); interest = new Interest(genes); gamete = new Gamete(genes, true, bioClock); cycle = new Cycle(genes, bioClock); embryo = null; }
public void Mature(Embryo embryo) { embryos.Remove(embryo.id); var juvenile = new Juvenile(embryo); juveniles[juvenile.id] = juvenile; var mother = females[juvenile.mother_id]; juvenile.SetLocation(mother.location); }
public Female(ConfigNode node) : base(node) { initialize(); interest.Load(node); cycle.Load(node); if (node.HasValue("state")) { fsm.StartFSM(node.GetValue("state")); } else { fsm.StartFSM("Fertile"); } if (node.HasValue("embryo")) { var zid = node.GetValue("embryo"); embryo = ProgenyScenario.current.GetEmbryo(zid); } }
public Juvenile(Embryo embryo) : base(embryo) { birthUT = embryo.Birth; init(); }
public void AddEmbryo(Embryo embryo) { embryos[embryo.id] = embryo; }