1 using System.Collections;
2 using System.Collections.Generic;
16 public GameObject chaosPrefab;
17 public float gridSpacing = 30f;
19 public Material[] materials;
24 int gridSize = Mathf.CeilToInt(Mathf.Sqrt((
float) count));
27 int materialCount = 0;
29 if (materials.Length == 0 ) {
30 Debug.Log(
"Need to specify materials");
32 Vector3 origin =
new Vector3(-gridSpacing*gridSize/2, gridSpacing*gridSize/2, 0f);
33 for (
int i=0; i < count; i++) {
34 Vector3 p = transform.position + origin;
35 p.x += gridSpacing * row;
36 p.y -= gridSpacing * col;
38 GameObject chaosSystem = Instantiate<GameObject>(chaosPrefab, p, Quaternion.identity);
39 chaosSystem.transform.parent = transform;
42 cm.
timeZoom = cm.GetEquation().GetSlideshowSpeed();
45 foreach ( LineRenderer lr
in cm.GetComponentsInChildren<LineRenderer>()) {
46 lr.sharedMaterial = materials[materialCount];
48 Text t = chaosSystem.GetComponentInChildren<Text>();
49 t.text = cm.GetEquation().GetName();
52 if (row >= gridSize) {
57 if (materialCount >= materials.Length)
59 Debug.Log(
"mc= " + materialCount);
Sample code to invoke a Chaos prefab for all equations provided by the factory and locate them in an ...
int selectedEqn
Number of chaos system to evolve (w.r.t. ChaosFactory list)
float timeZoom
Time scale (>0)
static List< ChaosEqn > GetEquations()
Returns a List of Equation objects. A singleton reference list is provided for the inspector script t...
Chaotic motion. Evolve the user specified chaotic system with the parameters held by the ChaoticSyste...
override void Init()
Init the equation using the selected equation and parameter bundle.