private void SetFunction(string[] args) { if (args[0] == "Ripple") { function = GraphFunctionName.Ripple; Console.Log("Switched to GraphFunctionName.Ripple"); } else if (args[0] == "Cylinder") { function = GraphFunctionName.Cylinder; Console.Log("Switched to GraphFunctionName.Cylinder"); } else if (args[0] == "Sphere") { function = GraphFunctionName.Sphere; Console.Log("Switched to GraphFunctionName.Sphere"); } else if (args[0] == "Torus") { function = GraphFunctionName.Torus; Console.Log("Switched to GraphFunctionName.Torus"); } else { Console.LogError("Graph Function " + args[0] + " does not exist!"); } }
public void setFunction(GraphFunctionName functionName) { if (function != GraphFunctionName.Bogo) { if (functionName == GraphFunctionName.Bogo) { setLight(Color.red); CameraSpinScript.setSpeed(15); function = functionName; textBox.text = functionString(functionName); } else { function = functionName; textBox.text = functionString(functionName); } } else { if (functionName == GraphFunctionName.Bogo) { CameraSpinScript.setSpeed(.2f); setLight(new Color(83f / 255f, 1f, 228f / 255f)); function = GraphFunctionName.Ripple; textBox.text = functionString(GraphFunctionName.Ripple); } } }
private void Update() { duration += Time.deltaTime; if (transitioning) { if (duration >= transitionDuration) { duration -= transitionDuration; transitioning = false; } } else if (duration >= functionDuration) { duration -= functionDuration; transitioning = true; transitionFunction = graphName; PickNextFunction(); } if (transitioning) { UpdateFunctionTransition(); } else { UpdateFunction(); } }
public void ButtonChangeGraph() { if ((int)function < functions.Length - 1) { function += 1; } else { function = 0; } }
public string functionString(GraphFunctionName functionName) { switch (functionName) { case GraphFunctionName.Bogo: return("BOGO"); case GraphFunctionName.MultiSine: return("Multi-Sine Function"); case GraphFunctionName.Ripple: return("Ripple Function"); case GraphFunctionName.Sine: return("Sine Function"); case GraphFunctionName.Sine2D: return("2D-Sine Function"); default: return(""); } }
public Graph(Transform[] points, int resolution, GraphFunctionName function) { this.resolution = resolution; this.points = points; this.function = function; }
public static Vector3 Morph(float u, float v, float t, GraphFunctionName from, GraphFunctionName to, float progress) { return(Vector3.LerpUnclamped(functions[(int)from](u, v, t), functions[(int)to](u, v, t), progress)); }
public static GraphFunctionName GetRandomFunctionNameOtherThan(GraphFunctionName name) { var choice = (GraphFunctionName)UnityEngine.Random.Range(1, functions.Length); return(choice == name ? 0 : choice); }
public static GraphFunctionName GetNextFunctionName(GraphFunctionName name) { return((int)name < functions.Length - 1 ? name + 1 : 0); }
private void PickNextFunction() { graphName = transitionMode == TransitionMode.Cycle ? GetNextFunctionName(graphName) : GetRandomFunctionNameOtherThan(graphName); }
public void SetMathFunction(GraphFunctionName f) { function = f; }
public void ChangeFunction(int f) { function = (GraphFunctionName)f; }