/// <summary> /// Adds a component using its inherent name. /// </summary> /// <param name="c">The component to add.</param> public static void Add(Component c) { while (InLoop) ; if(c != null && !Components.ContainsKey(c.Name)) Components.Add(c.Name, c); }
/// <summary> /// Adds a component using a specified name. /// </summary> /// <param name="componentName">The name under which the component will be.</param> /// <param name="c">The component to add.</param> public static void Add(string componentName, Component c) { while (InLoop) ; if (!Components.ContainsKey(componentName)) Components.Add(componentName, c); }
/// <summary> /// Update loop portion /// </summary> private static void Update(Component c) { if (c is IUpdatable) (c as IUpdatable).Update(TickTime); }
/// <summary> /// Render loop portion /// </summary> private static void Render(Component c) { if (c is IRenderable) (c as IRenderable).Render(TickTime); if (c is IDrawable) if ((c as IDrawable).DrawEnabled) (c as IDrawable).Draw(PreBuffer, 25, 80); }
/// <summary> /// Sets a component (or adds one if there is not one); /// </summary> /// <param name="name">The name of the component to set</param> /// <param name="c">The new component</param> public static void Set(string name, Component c) { while (InLoop) ; Remove(name); Add(name, c); }
/// <summary> /// Removes a specified component using its name. /// </summary> /// <param name="c">The component attempting to be removed.</param> /// <returns>If the component was removed (or even existed)</returns> public static bool Remove(Component c) { while (InLoop) ; return Components.Remove(c.Name); }
/// <summary> /// Gets a component specified by its name. /// </summary> /// <param name="name">The name of the component to get.</param> /// <param name="tryComponent">The possible gotten component</param> public static void Get(string name, out Component tryComponent) { Components.TryGetValue(name, out tryComponent); }