From a71efa41f09e878b5cfa68072e896df1a85bc51f Mon Sep 17 00:00:00 2001 From: realtradam Date: Wed, 7 Dec 2022 02:23:06 -0500 Subject: cleaner organization of functions --- Assets/Scripts/Graph.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'Assets/Scripts/Graph.cs') 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; } } -- cgit v1.2.3