コード例 #1
0
ファイル: LevelManager.cs プロジェクト: abztracta/westerdals
        // removes GameObject from all lists depending on type
        public void Remove(GameObject go)
        {
            GameObjects.Remove(go);

            var item = go as ICollidable;

            if (item != null)
            {
                Collidables.Remove(item);
            }

            var moveable = go as IMoveable;

            if (moveable != null)
            {
                Moveables.Remove(moveable);
            }

            var renderable = go as IRenderable;

            if (renderable != null)
            {
                Renderables.Remove(renderable);
            }
        }
コード例 #2
0
 public void RemoveMoveable(string nonTerminal)
 {
     if (!Moveables.Contains(nonTerminal))
     {
         return;
     }
     Moveables.Remove(nonTerminal);
 }
コード例 #3
0
 public void Remove(IWadObjectId wadObjectId)
 {
     if (wadObjectId is WadMoveableId)
     {
         Moveables.Remove((WadMoveableId)wadObjectId);
     }
     else if (wadObjectId is WadStaticId)
     {
         Statics.Remove((WadStaticId)wadObjectId);
     }
     else if (wadObjectId is WadSpriteSequenceId)
     {
         SpriteSequences.Remove((WadSpriteSequenceId)wadObjectId);
     }
     else
     {
         throw new ArgumentException("Argument not of a valid type.");
     }
 }
コード例 #4
0
        public AnimatedModel GetMoveable(WadMoveable moveable, bool maybeRebuildAll = true)
        {
            // Check if the data is already loaded
            // If yes attempt to use that one
            AnimatedModel model;

            if (Moveables.TryGetValue(moveable, out model))
            {
                if (model.Version >= moveable.Version)
                {
                    return(model);
                }
                ReclaimTextureSpace(model);
                model.Dispose();
                Moveables.Remove(moveable);
            }

            // The data is either new or has changed, unfortunately we need to reload it
            try
            {
                model = AnimatedModel.FromWadMoveable(GraphicsDevice, moveable, AllocateTexture);
            }
            catch (TextureAtlasFullException exc)
            {
                logger.Info(exc.Message);

                if (maybeRebuildAll)
                {
                    logger.Info("Starting to rebuild the entire atlas.");
                    Dispose();
                    return(GetMoveable(moveable, false));
                }
            }
            Moveables.Add(moveable, model);
            return(model);
        }
コード例 #5
0
 public void RemoveMoveable(IMoveable moveable)
 {
     Moveables.Remove(moveable);
 }