// Use this for initialization void Start () { this.CP = new CalculatePosition(); this.RBM = new RandomBoxMuller(); this.targetHuman0 = 0; this.targetHuman1 = 0; this.IsUseKinet = false; this.preCenter = Vector3.zero; this.preSD = 0; }
private void MAKEDATA(ref double[,] _designmatrix, ref double[] _t, ref double[] _X) { var r = new RandomBoxMuller(); RandomMT rand = new RandomMT(1); for (int i = 0; i < CONST.N; i++) { _X[i] = rand.Double() * Math.PI * 2; _t[i] = System.Math.Sin(_X[i]) + r.next(); } for (int j = 0; j < CONST.N; j++) { for (int i = 0; i < CONST.M; i++) { _designmatrix[j, i] = System.Math.Pow(_X[j], i); if (i == 0) { _designmatrix[j, i] = 1; } } } }
// Use this for initialization IEnumerator letsgo() { for (int i = 0; i < 50; i++) { yield return(0); GameObject g = Instantiate(quardPrefab); var shaperobj = g.GetComponent <shaper>(); var random = new RandomBoxMuller(); g.transform.position = new Vector3((float)random.next() * 5f, (float)random.next() * 5f, 0.0f); float scaleset = Mathf.Abs((float)random.next()) * 5f + 1f; g.transform.localScale = new Vector3(scaleset, scaleset, 0.0f); g.transform.rotation = Quaternion.Euler((float)random.next() * 90f, 0.0f, (float)random.next() * 360f); //fill List <float> plist = new List <float>() { 0.6f, 0.2f, 0.1f, 0.1f }; List <List <Texture2D> > filllist = new List <List <Texture2D> > () { gradation, pattern, glitch, surface }; float p = Mathf.Abs((float)random.next()); float countup = 0f; countup = 0f; for (int j = 0; j < filllist.Count; j++) { countup += plist[j]; if (p < countup) { if (j != 1 && UnityEngine.Random.Range(0f, 1f) > 0.5) { shaperobj.scalevalue = 1f; } else { shaperobj.scalevalue = shaperobj.transform.localScale.x; } shaperobj.fill = filllist[j][UnityEngine.Random.Range(0, filllist[j].Count)]; break; } } //line List <List <Texture2D> > linelist = new List <List <Texture2D> >() { gradation, pattern, glitch, surface, black }; List <Texture2D> selected = linelist[UnityEngine.Random.Range(0, linelist.Count)]; shaperobj.line = selected[UnityEngine.Random.Range(0, selected.Count)]; //sape shaperobj.mask = shapemask[UnityEngine.Random.Range(0, shapemask.Count)]; shaperobj.init(); } }