public void Set(GrowableGenetics.GeneType geneType, bool firstSet = false) { if (firstSet) { SetPrevious(geneType); } else { SetPrevious(Type); } Type = geneType; }
public int GetGeneTypeCount(GrowableGenetics.GeneType geneType) { int num = 0; GrowableGene[] genes = Genes; for (int i = 0; i < genes.Length; i++) { if (genes[i].Type == geneType) { num++; } } return(num); }
public static bool IsPositive(GrowableGenetics.GeneType type) { switch (type) { case GrowableGenetics.GeneType.Empty: return(false); case GrowableGenetics.GeneType.GrowthSpeed: return(true); case GrowableGenetics.GeneType.Hardiness: return(true); case GrowableGenetics.GeneType.WaterRequirement: return(false); case GrowableGenetics.GeneType.Yield: return(true); default: return(false); } }
public static string GetDisplayCharacter(GrowableGenetics.GeneType type) { switch (type) { case GrowableGenetics.GeneType.Empty: return("X"); case GrowableGenetics.GeneType.GrowthSpeed: return("G"); case GrowableGenetics.GeneType.Hardiness: return("H"); case GrowableGenetics.GeneType.WaterRequirement: return("W"); case GrowableGenetics.GeneType.Yield: return("Y"); default: return("U"); } }
private GrowableGenetics.GeneType PickWeightedGeneType() { IOrderedEnumerable <GrowableGenetics.GeneWeighting> orderedEnumerable = slotWeights.OrderBy((GrowableGenetics.GeneWeighting w) => w.Weighting); float num = 0f; foreach (GrowableGenetics.GeneWeighting item in orderedEnumerable) { num += item.Weighting; } GrowableGenetics.GeneType result = GrowableGenetics.GeneType.Empty; float num2 = Random.Range(0f, num); float num3 = 0f; foreach (GrowableGenetics.GeneWeighting item2 in orderedEnumerable) { num3 += item2.Weighting; if (num2 < num3) { return(item2.GeneType); } } return(result); }
public static string GetColourCodedDisplayCharacter(GrowableGenetics.GeneType type) { return("<color=" + (IsPositive(type) ? "#60891B>" : "#AA4734>") + GetDisplayCharacter(type) + "</color>"); }
public void SetPrevious(GrowableGenetics.GeneType type) { PreviousType = type; }