forked from andkok/MWS_2021
dodanie losowego konta dla Anabeny
This commit is contained in:
parent
d98f4f0f23
commit
d21008355e
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -18,12 +18,41 @@ public class AnabaenaTurtle : TurtleLSystem {
|
||||
var bigR = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "bigR"), typeof(GameObject));
|
||||
var l = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "l"), typeof(GameObject));
|
||||
var r = (GameObject)AssetDatabase.LoadAssetAtPath(String.Format(path, "r"), typeof(GameObject));
|
||||
var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3(0.05f, 0.1f, 0.05f));
|
||||
|
||||
|
||||
// wywalenie za długich lambd
|
||||
Tuple<GameObject, Matrix4x4> lInterpretation(float[] args) {
|
||||
return new Tuple<GameObject, Matrix4x4>(
|
||||
// dodanie do anabeny obrotu o losowy kąt Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) *
|
||||
l, Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) * Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f)));
|
||||
}
|
||||
|
||||
Tuple<GameObject, Matrix4x4> rInterpretation(float[] args) {
|
||||
// dodanie do anabeny obrotu o losowy kąt Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) *
|
||||
return new Tuple<GameObject, Matrix4x4>(
|
||||
r, Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) * Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f)));
|
||||
}
|
||||
|
||||
Tuple<GameObject, Matrix4x4> bigLInterpretation(float[] args) {
|
||||
// dodanie do anabeny obrotu o losowy kąt Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) *
|
||||
return new Tuple<GameObject, Matrix4x4>(
|
||||
bigL, Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) * Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f)));
|
||||
}
|
||||
|
||||
Tuple<GameObject, Matrix4x4> bigRInterpretation(float[] args) {
|
||||
// dodanie do anabeny obrotu o losowy kąt Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) *
|
||||
return new Tuple<GameObject, Matrix4x4>(
|
||||
bigR, Matrix4x4.Rotate(Quaternion.Euler(0,0, UnityEngine.Random.Range(-20, 20))) * Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f)));
|
||||
}
|
||||
|
||||
|
||||
//creating functions that are used for interpretation
|
||||
turtleInterpretation.Add("l", (float[] args) => new Tuple<GameObject, Matrix4x4>(l, Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f))));
|
||||
turtleInterpretation.Add("r", (float[] args) => new Tuple<GameObject, Matrix4x4>(r, Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f))));
|
||||
turtleInterpretation.Add("L", (float[] args) => new Tuple<GameObject, Matrix4x4>(bigL, Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f))));
|
||||
turtleInterpretation.Add("R", (float[] args) => new Tuple<GameObject, Matrix4x4>(bigR, Matrix4x4.Translate(new Vector3(0.1f, 0, 0)) * Matrix4x4.Scale(new Vector3(0.1f, 0.1f, 0.1f))));
|
||||
turtleInterpretation.Add("l", lInterpretation);
|
||||
turtleInterpretation.Add("r", rInterpretation);
|
||||
turtleInterpretation.Add("L", bigLInterpretation);
|
||||
turtleInterpretation.Add("R", bigRInterpretation);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user