public bool Update(List <AnimationParticle> l) { if (current_frame >= total_frames) { return(false); } ++current_frame; int num_this_frame = num_per_frame.GetValue(); for (int num = 0; num < num_this_frame; ++num) { float angle = (float)(R.r.NextDouble() * 2.0 * Math.PI); float dist = dist_from_origin.GetValue(); l.Add(new AnimationParticle(duration_of_particle.GetValue(), origin_row + (float)Math.Sin(angle) * dist, origin_col + (float)Math.Cos(angle) * dist, 0, 0, sprite_h, sprite_w, primary_color, secondary_color)); } return(true); }
public float GetValue() { //also, need to enforce the requirement that every number eventually evaluates to a float. switch (type) { case NumberType.Range: { while (true) { float min = rangeMin.GetValue(); float max = rangeMax.GetValue(); float result = (Random.value * (max - min) + min); if (!float.IsInfinity(result) && !float.IsNaN(result)) { return(result); } } } case NumberType.Sequence: { float result = sequence[sequenceIndex].GetValue(); ++sequenceIndex; if (sequenceIndex == sequence.Count) { sequenceIndex = 0; } return(result); } case NumberType.Delta: { float result = value; value += delta.GetValue(); return(result); } //case NumberType.Value: default: return(value); } }