public int GetBirthCost() { PrefabLoaderWrapper_script pl = PrefabLoaderWrapper_script.GetPL(); List <Gene> Genes = GetGenes(); int sum = 0; foreach (Gene gene in Genes) { string type = gene.GetCellType().ToString(); if (type == "None") { continue; } GameObject cell = pl.Load(type, "cells"); if (cell == null) { continue; } sum += cell.GetComponent <Cell_script>().GetStartCost(); } return(sum); }
// Use this for initialization void Start() { pl = PrefabLoaderWrapper_script.GetPL(); Seed = pl.Load("Seed"); CreateOrganisms(); }
void Awake() { pl = PrefabLoaderWrapper_script.GetPL(); if (customDNA != null) { DNA = new DNA(DNAU.GeneEntries2GeneList(customDNA)); } OrganismPrefab = pl.Load("Organism"); }
public void Birth() { DNA newDNA = GetDNA().Duplicate(); GameObject seedprefab = pl.Load("Seed"); Vector2 source = new Vector2(transform.position.x, transform.position.y); Vector2 pos = source + Random.insideUnitCircle.normalized * 5; GameObject seed = Instantiate(seedprefab, pos, Quaternion.identity) as GameObject; seed.GetComponent <Seed_script>().SetDNA(newDNA); }
public int CalcBirthReq(PrefabLoaderWrapper_script pl) { int ret = 0; List <IDictionary <string, int> > parsedDNA = ParseDNA(); foreach (IDictionary <string, int> e in parsedDNA) { string type = GetCellById(e["type"]); GameObject cell = pl.Load(type, "cells"); if (cell == null) { continue; } ret += cell.GetComponent <Cell_script>().GetStartCost(); } return(ret); }
private void CreateCell(Vector2 origin, CellType type, int x, int y, GameObject Organism) { if (type == CellType.None) { return; } GameObject cell = pl.Load(type.ToString(), "cells"); if (cell == null) { return; } Vector2 pos = new Vector2(x - origin.x, y - origin.y); GameObject go = Instantiate(cell, pos, Quaternion.identity, Organism.transform) as GameObject; go.GetComponent <Cell_script>().SetDNA(DNA.PerfectDuplicate()); }
// Use this for initialization void Start() { Food = pl.Load("Food"); CreateFood((int)(2 * Mathf.PI * radius) * density); }