public static void add_Pulse_Point(Vector4 point, float time, float rad) { //Point_Time p = new Point_Time(point); Point_Time p = new Point_Time(point, time, rad); if (!m_pulse_points.Add(p)) // returns true if added. returns false is item is already present { m_pulse_points.Remove(p); m_pulse_points.Add(p); } }
public static void add_Point(Vector4 point, float time, float rad) { //Point_Time p = new Point_Time(point); Point_Time p = new Point_Time(point, time, rad); while (!m_points.Add(p)) // only goes into the loop is the item is already there { Random r = new Random(); Vector4 tweak = new Vector4((float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), 0.0f); p.tweak_time(tweak); } }
public static void remove_Pulse_Point(Vector4 point) { Point_Time p = new Point_Time(point, 0.0f, 0.0f); // time and radius doesn't matter for comparison if (m_pulse_points.Contains(p)) { m_pulse_points.Remove(p); } }