Example #1
0
        public void Contains()
        {
            MyComponent c = new MyComponent(game);

            components.Add(c);
            Assert.IsTrue(components.Contains(c), "Failed to find MyComponent");
        }
Example #2
0
 /// <summary>
 /// Adds the given component to this GameState.
 /// </summary>
 public void AddComponent(GameStateComponent Component)
 {
     if (_Components.Contains(Component))
     {
         throw new ArgumentException("Component was already part of this GameState.");
     }
     this._Components.Add(Component);
 }
Example #3
0
 public void SetStateProfil()
 {
     Reset();
     if (profil == null)
     {
         profil = new Profil(game);
         components.Add(profil);
     }
     else if (!components.Contains(profil))
     {
         profil = null;
         profil = new Profil(game);
         components.Add(profil);
         profil.MenĂ¼ = true;
         profil.Opt  = true;
         profil.Esc  = true;
     }
     inputFocus = profil;
 }
Example #4
0
        /// <summary>
        /// When a componenet removed from the game, it will be also removed from the screen.
        /// </summary>
        /// <param name="i_Sender">Sender object.</param>
        /// <param name="i_ArgsHolder">Arguments holder.</param>
        private void components_ComponentRemoved(object i_Sender, GameComponentCollectionEventArgs i_ArgsHolder)
        {
            IGameComponent component = i_ArgsHolder.GameComponent;

            if (!m_constGameComponentCollection.Contains(component))
            {
                if (m_gameComponentCollection.Contains(component))
                {
                    m_gameComponentCollection.Remove(component);
                }

                if (m_gameDrawableComponentCollection.Contains(component))
                {
                    m_gameDrawableComponentCollection.Remove(component);
                }

                if (ComponentRemoved != null)
                {
                    ComponentRemoved.Invoke(component);
                }
            }
        }