diff options
| author | realtradam <[email protected]> | 2022-12-07 02:23:06 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-12-07 02:23:06 -0500 |
| commit | a71efa41f09e878b5cfa68072e896df1a85bc51f (patch) | |
| tree | c2bad6ee8c4613160f66abae24334aa9b90836ac /Assets/Scripts/Graph.cs | |
| parent | ba11c1f9a934ebb59d56348b78ac0bd687135585 (diff) | |
| download | UnityDancingGraph-a71efa41f09e878b5cfa68072e896df1a85bc51f.tar.gz UnityDancingGraph-a71efa41f09e878b5cfa68072e896df1a85bc51f.zip | |
cleaner organization of functions
Diffstat (limited to 'Assets/Scripts/Graph.cs')
| -rw-r--r-- | Assets/Scripts/Graph.cs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Assets/Scripts/Graph.cs b/Assets/Scripts/Graph.cs index 760d4c8..1b4ad63 100644 --- a/Assets/Scripts/Graph.cs +++ b/Assets/Scripts/Graph.cs @@ -42,22 +42,12 @@ public class Graph : MonoBehaviour // Update is called once per frame void Update() { + MathFunctionLibrary.Function visual_function = MathFunctionLibrary.GetFunction(function); float time = Time.time; for(int i = 0; i < points.Length; i++) { Transform point = points[i]; Vector3 position = point.localPosition; - if(function == 0) - { - position.y = MathFunctionLibrary.Wave(position.x, time); - } - else if(function == 1) - { - position.y = MathFunctionLibrary.MultiWave(position.x, time); - } - else if(function == 2) - { - position.y = MathFunctionLibrary.Ripple(position.x, time); - } + position.y = visual_function(position.x, time); point.localPosition = position; } } |
