private void InitStemSplineMesh(GameObject stemObject, StemLocalData stemData) { stemObject.AddComponent <StemLocalData>(); stemData = stemObject.GetComponent <StemLocalData>().AssignValues(stemData); CurrentMainSpline = Util.InitSpline(Stem, stemData.SproutNodes); InitMesh(Stem); ApplyColorToMesh(Stem, stemData.Color); }
//public StemLocalData() { } //public StemLocalData(StemLocalData data) //{ // isBranch = data.isBranch; // SproutNodes = data.SproutNodes; // Nodes = data.Nodes; // SproutThickness = data.SproutThickness; // StemThickness = data.StemThickness; // Color = data.Color; //} public StemLocalData AssignValues(StemLocalData data) { isBranch = data.isBranch; SproutNodes = data.SproutNodes; Nodes = data.Nodes; SproutThickness = data.SproutThickness; StemThickness = data.StemThickness; Color = data.Color; return(this); }
private StemLocalData DistributeMainStemLocalData(RandomPath sproutRandomPath, RandomPath stemRandomPath, ColorData colorData, bool isBranch = false) { StemLocalData data = new StemLocalData(); data.isBranch = isBranch; data.Nodes = DistributePath(stemRandomPath); data.SproutNodes = Util.MatchNodeCount(DistributePath(sproutRandomPath), data.Nodes); data.SproutThickness = new Vector2(sproutRandomPath.pathMeshProperties.Thickness.min, sproutRandomPath.pathMeshProperties.Thickness.max); data.StemThickness = new Vector2(stemRandomPath.pathMeshProperties.Thickness.min, stemRandomPath.pathMeshProperties.Thickness.max); data.Color = !colorData.isRandom ? colorData.Color : Util.GetColorFromRange(colorData.ColorRange1, colorData.ColorRange2); return(data); }
public PlantLocalData(PlantFormData data) { InitialTime = DateTime.Now; PlantName = data.plantName; Description = data.description; Rotation = Util.RandomRange(-150f, -30f); PlantFormType = data.plantFormType; FlowerFormType = data.flowerFormType; PetalPrefab = data.PetalPrefab; PistilPrefab = data.PistilPrefab; BudPrefab = data.BudPrefab; LeafPrefab = data.LeafPrefab; SproutParticles = data.SproutParticles; CurrentAnimationState = FlowerAnimationState.Sprout; LastStateChangedTime = InitialTime; AnimationDurationList = new List <float>() { data.SproutAnimationDuration, data.GrowAniamtionDuration, data.BloomAnimationDuration, data.FallAnimationDuration, data.RebloomAnimationDuration }; AnimationCycleTime = data.BloomAnimationDuration + data.FallAnimationDuration + data.RebloomAnimationDuration; MainStem = DistributeMainStemLocalData(data.SproutPathData, data.StemPathData, data.StemColorData); Flower = DistributeFlowerLocalData(data.PetalData, data.PetalColorData); Petals = DistributePetalLocalData(Flower, data.PetalData); Leaves = DistributeLeafLocalData(data.leafGrowRelation, data.SproutLeafData, data.GrownLeafData, data.LeafColorData); Debug.Log("PlantLocalData Constructed"); }