public string nextFunction() { current_func_index++; if (current_func_index >= functions.Count) { current_func_index = 0; } current_func = functions[current_func_index]; generate(); return(function_names[current_func_index]); }
public string prevFunction() { current_func_index--; if (current_func_index < 0) { current_func_index = functions.Count - 1; } current_func = functions[current_func_index]; generate(); return(function_names[current_func_index]); }
void Awake() { ps = GetComponent <ParticleSystem>(); functions = new List <GraphFunc> { sin_xz, xz, cos_x_sin_z, normal_distr, sphere_top, sphere_bottom }; function_names = new List <string> { "sin_xz", "xz", "cos_x_sin_z", "normal_distr", "sphere_top", "sphere_bottom" }; function_descriptions = new List <string> { "sin(xy)", "xy", "cos(x) + sin(y)", "exp(1 - x^2 - y^2)", "+sqrt(9 - x^2 - y^2)", "-sqrt(9 - x^2 - y^2)" }; n_particles_x = (x_max - x_min) * resolution; n_particles_z = (z_max - z_min) * resolution; n_particles = n_particles_x * n_particles_z; Debug.Log("n_particles: " + n_particles); particles = new ParticleSystem.Particle[n_particles]; current_func = cos_x_sin_z; //GraphFunc func_1 = sphere_bottom; generate(); }//Awake()