Пример #1
0
 //This method takes the sprites from the temporary list and adds them to the main sprites list prior to running the update loop
 private void AddNewSprites()
 {
     foreach (Sprite sprite in NewSprites)
     {
         LevelSprites.Add(sprite);
         if (sprite is ICollidable)
         {
             game.CollisionHandler.CollisionListenersList.Add((ICollidable)sprite);
         }
     }
     NewSprites.Clear();
 }
Пример #2
0
 public void RemoveDeadSprites()
 {
     foreach (Sprite sprite in DeadSprites)
     {
         LevelSprites.Remove(sprite);
         Game1.Instance.CollisionHandler.AllElements.Remove(sprite);
         if (sprite is ICollidable)
         {
             Game1.Instance.CollisionHandler.CollisionListenersList.Remove((ICollidable)sprite);
         }
     }
     DeadSprites.Clear();
 }
Пример #3
0
        public ModifyObject PreviousType()
        {
            ObjectInstance selection = editor.GetSelectedItem();
            int            newIndex  = selection.GetTypeIndex();

            if (selection is StructInstance)
            {
                newIndex = (newIndex + CurrentLevel.StructCount - 1) % CurrentLevel.StructCount;
            }
            else if (selection is EnemyInstance)
            {
                SpriteDefinition[] levelSprites = LevelSprites.GetSprites(editor.CurrentLevel);
                int enemyTypeCount = levelSprites.Length;

                do
                {
                    newIndex = (newIndex + enemyTypeCount - 1) % enemyTypeCount;
                } while (levelSprites[newIndex].IsBlank || levelSprites[newIndex].IsInvalid);
            }
            return(new ModifyObject(queue, CurrentScreen, editor.GetSelectedItem(), newIndex, ObjectModification.Type));
        }