// Start is called before the first frame update void Start() { //reading gene script for variable values if (readGenesOnStart) { Genes genes = GetComponent <Genes>(); if (genes != null) { try { expectedLifetime = genes.GetValue <int>("expectedLifetime"); deathTimeSkew = genes.GetValue <float>("deathTimeSkew"); } catch (Exception e) { print(e); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } BalanceFloats(allDependencies, 0, maxEfficiency); } timeAliveLeft = expectedLifetime; }
// Start is called before the first frame update void Start() { //reading gene script for variable values if (readGenesOnStart) { Genes genes = GetComponent <Genes>(); if (genes != null) { try { dependencyAmount = genes.GetValue <float>("dependencyAmount"); minValue = genes.GetValue <int>("minValue"); maxValue = genes.GetValue <int>("maxValue"); optimumPercentage = genes.GetValue <float>("optimumPercentage"); } catch (Exception e) { print(e.ToString()); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } } depAmountChanged = false; prevDepAmount = dependencyAmount; }
// Start is called before the first frame update void Start() { if (readGenesOnStart) { Genes genes = GetComponent <Genes>(); if (genes != null) { try { ColorUtility.TryParseHtmlString(genes.GetValue <string>("earlyColor"), out earlyColor); ColorUtility.TryParseHtmlString(genes.GetValue <string>("optimumColor"), out optimumColor); ColorUtility.TryParseHtmlString(genes.GetValue <string>("lateColor"), out lateColor); healthToColorRatio = genes.GetValue <float>("healthToColorRatio"); } catch (Exception e) { print(e); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } } }
// Start is called before the first frame update void Start() { hasStarted = false; if (readGenesOnStart) { Genes genes = GetComponent <Genes>(); if (genes != null) { try { expectedGrowTime = genes.GetValue <int>("expectedGrowTime"); growthTimeSkew = genes.GetValue <float>("growthTimeSkew"); timeTillStart = genes.GetValue <int>("timeTillStart"); } catch (Exception e) { print(e.ToString()); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } currGrowTime = expectedGrowTime; } }
// Start is called before the first frame update void Start() { d = false; //reading gene script for variable values if (readGenesOnStart) { leaves = null; ResetLeaves(); Genes genes = GetComponent <Genes>(); if (genes != null) { try { Sprite tmpSprite = Resources.Load <Sprite>("sprites/" + genes.GetValue <string>("sprite")); if (tmpSprite == null) { throw new Exception(String.Format("There's no sprite 'Resources/sprites/{0}'", genes.GetValue <string>("sprite"))); } else { sprite = tmpSprite; } leafCount = genes.GetValue <int>("leafCount"); angle = genes.GetValue <float>("angle"); rotationOffset = genes.GetValue <float>("rotationOffset"); sproutSize = genes.GetValue <float>("sproutSize"); invHeightSkew = genes.GetValue <bool>("invHeightSkew"); heightOffset = genes.GetValue <float>("heightOffset"); heightOffsetPower = genes.GetValue <float>("heightOffsetPower"); offsetSpawnPoint = Parse.Vec2(genes.GetValue <string>("offsetSpawnPoint")); leafScale = Parse.Vec2(genes.GetValue <string>("leafScale")); } catch (Exception e) { print(e); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } } }
// Start is called before the first frame update void Start() { //load genes for fields if (readGenesOnStart) { Genes genes = GetComponent <Genes>(); if (genes != null) { try { scaleAmount = Parse.Vec2(genes.GetValue <string>("scaleAmount")); } catch (Exception e) { print(e.ToString()); Debug.LogWarning("A gene could not be read, some variables may be using default values!", gameObject); } } else { Debug.LogWarning(String.Format("A gene script was not given to '{0}', using default values!", name), gameObject); } } }