Beispiel #1
0
        /// <summary>
        /// Adds gameObjects from AddActive list to their correct active lists.
        /// </summary>
        public void AddToActive()
        {
            for (int i = 0; i < AddActive.Count(); i++)
            {
                GameObject go = AddActive[i];


                if (go.GetComponent <Clutter>() != null)
                {
                    ActiveClutterList.Add(go);
                    if (InactiveClutterList.Contains(go))
                    {
                        InactiveClutterList.Remove(go);
                    }
                }
                if (go.GetComponent <Projectile>() != null)
                {
                    ActiveProjectileList.Add(go);
                    if (InactiveProjectileList.Contains(go))
                    {
                        InactiveProjectileList.Remove(go);
                    }
                }
                if (go.GetComponent <Environment>() != null)
                {
                    ActiveEnvironmentList.Add(go);
                    if (InactiveEnvironmentList.Contains(go))
                    {
                        InactiveEnvironmentList.Remove(go);
                    }
                }
            }
            AddActive.Clear();
        }
Beispiel #2
0
 /// <summary>
 /// Makes all active gameobjects inactive.
 /// </summary>
 public void ClearLists()
 {
     for (int i = 0; i < ActiveProjectileList.Count(); i++)
     {
         RemoveActive.Add(ActiveProjectileList[i]);
     }
     for (int i = 0; i < ActiveClutterList.Count(); i++)
     {
         RemoveActive.Add(ActiveClutterList[i]);
     }
     for (int i = 0; i < ActiveEnvironmentList.Count(); i++)
     {
         RemoveActive.Add(ActiveEnvironmentList[i]);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Draws all gameObjects in all the lists.
        /// </summary>
        /// <param name="gameTime"></param>
        public void Draw(SpriteBatch spriteBatch)
        {
            player.Draw(spriteBatch);

            for (int i = 0; i < ActiveClutterList.Count(); i++)
            {
                ActiveClutterList[i].Draw(spriteBatch);
            }
            for (int i = 0; i < ActiveProjectileList.Count(); i++)
            {
                ActiveProjectileList[i].Draw(spriteBatch);
            }
            for (int i = 0; i < ActiveEnvironmentList.Count(); i++)
            {
                ActiveEnvironmentList[i].Draw(spriteBatch);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Updates all gameObjects in all the lists.
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            player.Update(gameTime);

            for (int i = 0; i < ActiveClutterList.Count(); i++)
            {
                ActiveClutterList[i].Update(gameTime);
            }
            for (int i = 0; i < ActiveProjectileList.Count(); i++)
            {
                ActiveProjectileList[i].Update(gameTime);
            }
            for (int i = 0; i < ActiveEnvironmentList.Count(); i++)
            {
                ActiveEnvironmentList[i].Update(gameTime);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Moves gameObjects from RemoveActive lists to inactive lists
        /// </summary>
        public void RemoveFromActive()
        {
            for (int i = 0; i < RemoveActive.Count(); i++)
            {
                GameObject go = RemoveActive[i];

                if (go.GetComponent <Clutter>() != null)
                {
                    InactiveClutterList.Add(go);
                    ActiveClutterList.Remove(go);
                }
                if (go.GetComponent <Projectile>() != null)
                {
                    InactiveProjectileList.Add(go);
                    ActiveProjectileList.Remove(go);
                }
                if (go.GetComponent <Environment>() != null)
                {
                    InactiveEnvironmentList.Add(go);
                    ActiveEnvironmentList.Remove(go);
                }
            }
            RemoveActive.Clear();
        }