void OnEnable() { ChaoticSystem chaotic = (ChaoticSystem)target; eqns = ChaosEqnFactory.GetEquations(); eqnNames = new string[eqns.Count]; int index = 0; foreach (ChaosEqn eqn in eqns) { eqnNames[index] = eqn.GetName(); index++; } }
// Use this for initialization void Start() { int count = ChaosEqnFactory.GetEquations().Count; int gridSize = Mathf.CeilToInt(Mathf.Sqrt((float)count)); int row = 0; int col = 0; int materialCount = 0; // set position in grid if (materials.Length == 0) { Debug.Log("Need to specify materials"); } Vector3 origin = new Vector3(-gridSpacing * gridSize / 2, gridSpacing * gridSize / 2, 0f); for (int i = 0; i < count; i++) { Vector3 p = transform.position + origin; p.x += gridSpacing * row; p.y -= gridSpacing * col; GameObject chaosSystem = Instantiate <GameObject>(chaosPrefab, p, Quaternion.identity); chaosSystem.transform.parent = transform; ChaoticMotion cm = chaosSystem.GetComponentInChildren <ChaoticMotion>(); cm.selectedEqn = i; cm.timeZoom = cm.GetEquation().GetSlideshowSpeed(); cm.Init(); // Use the specified materials to color the attractor trails differently foreach (LineRenderer lr in cm.GetComponentsInChildren <LineRenderer>()) { lr.sharedMaterial = materials[materialCount]; } Text t = chaosSystem.GetComponentInChildren <Text>(); t.text = cm.GetEquation().GetName(); // advance to next grid slot row++; if (row >= gridSize) { row = 0; col++; } materialCount++; if (materialCount >= materials.Length) { materialCount = 0; } Debug.Log("mc= " + materialCount); } }
// Use this for initialization void Start() { nextSlideTime = Time.time + timer; eqns = ChaosEqnFactory.GetEquations(); maxSlide = eqns.Count; eqnNames = new string[maxSlide]; int index = 0; foreach (ChaosEqn eqn in eqns) { eqnNames[index] = eqn.GetName(); index++; } chaoticParticles = GetComponent <ChaoticParticles>(); chaoticParticles.selectedEqn = currentSlide; slideLabel.text = eqnNames[currentSlide]; chaoticParticles.timeZoom = eqns[currentSlide].GetSlideshowSpeed() * speedTrim; chaoticParticles.Init(); particleSys = GetComponent <ParticleSystem>(); initialRotation = transform.rotation; }
// Use this for initialization void Start() { nextSlideTime = Time.time + timer; eqns = ChaosEqnFactory.GetEquations(); maxSlide = eqns.Count; eqnNames = new string[maxSlide]; int index = 0; foreach (ChaosEqn eqn in eqns) { eqnNames[index] = eqn.GetName(); index++; } chaoticMotion = GetComponent <ChaoticMotion>(); chaoticMotion.selectedEqn = currentSlide; chaoticMotion.timeZoom = eqns[currentSlide].GetSlideshowSpeed(); slideLabel.text = eqnNames[currentSlide]; chaoticMotion.Init(); // get trail (if present) chaosTrail = GetComponentInChildren <ChaosTrail>(); initialRotation = transform.rotation; }