public bool IsEqual(IResource resource) { if (resource is Entity) { var entity = resource as Entity; foreach (var sprite in entity.Sprites) { if (!Sprites.Contains(sprite)) { return(false); } } foreach (var template in entity.Templates) { if (!Templates.Contains(template)) { return(false); } } return(entity.ID != ID && entity.Filename != Filename && entity.Sprites.Count != Sprites.Count); } return(false); }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here foreach (var item in Sprites) { item.Update(gameTime); } //agrego los nuevos sprites foreach (var item in newSprites) { if (Sprites.Contains(item)) { Sprites.Remove(item); } else { Sprites.Add(item); } } newSprites.Clear(); //borro los nuevos sprites //pausa if (gameTime.TotalGameTime.Subtract(t_anterior) > new TimeSpan(0, 0, 0, 0, 100)) { if (Keyboard.GetState().IsKeyDown(Keys.P)) { pausa = !pausa; t_anterior = gameTime.TotalGameTime; } } if (pausa) { return; } }