Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Update loop portion
 /// </summary>
 private static void Update(Component c)
 {
     if (c is IUpdatable)
         (c as IUpdatable).Update(TickTime);
 }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
 /// <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);
 }
Ejemplo n.º 7
0
 /// <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);
 }