public Birb SetBirbStats(Birb birb) { speciesId = birb.speciesId; birbColor = birb.birbColor; birbSprite = birb.birbSprite; parents = birb.parents; status = birb.status; stats = birb.stats; birbLocation = birb.birbLocation; hatched = birb.hatched; SetBirbSpritesAndColours(); return((Birb)this.MemberwiseClone()); }
public Birb CreateNewBirbFromParents(Birb parent1, Birb parent2, Enums.BirbLocation location = Enums.BirbLocation.NestParentsEgg) { parents = new List <Birb>(); parents.Add(parent1.GetCopy()); parents.Add(parent2.GetCopy()); hatched = false; int species = Random.Range(0, parents.Count); speciesId = parents[species].speciesId; birbSprite = parents[species].birbSprite; BirbColors tempColors = new BirbColors(); //generate birb from parents if it has any, otherwise use defaults //TODO: make better algorithm here for getting parent traits tempColors.head = parents[Random.Range(0, parents.Count)].birbColor.head; tempColors.body = parents[Random.Range(0, parents.Count)].birbColor.body; tempColors.tail = parents[Random.Range(0, parents.Count)].birbColor.tail; tempColors.wings = parents[Random.Range(0, parents.Count)].birbColor.wings; birbColor = tempColors.MutateColors(tempColors); stats.breedTime = parents[Random.Range(0, parents.Count)].stats.breedTime; stats.carryWeight = parents[Random.Range(0, parents.Count)].stats.carryWeight; stats.collectAmount = parents[Random.Range(0, parents.Count)].stats.collectAmount; stats.collectTime = parents[Random.Range(0, parents.Count)].stats.collectTime; stats.growthPercent = 0f; stats.growthRate = parents[Random.Range(0, parents.Count)].stats.growthRate; stats.hatchTime = parents[Random.Range(0, parents.Count)].stats.hatchTime; stats.moveSpeed = parents[Random.Range(0, parents.Count)].stats.moveSpeed; stats.sight = parents[Random.Range(0, parents.Count)].stats.sight; birbLocation = location; return((Birb)this.MemberwiseClone()); //else //{ // //tempColors = GameObject.Find("CrappyDatabas").GetComponent<CrappyDatabase>().GetSpeciesById(speciesId).GetWeightedDefaultColor(); //} //birbImage = GameObject.Find("CrappyDatabas").GetComponent<CrappyDatabase>().GetSpeciesById(speciesId).image; }