public Chest(Game game, GameScreen owner, String fullPath, Vector2 position) { super(game); _path = fullPath; _isClicked = false; _position = position; _owner = owner; Clicked = new event(this); ShopOpened = new event(this); ShopClosed = new event(this); ItemBought = new event(this); ShopOpened.Add(ShopOpenProcessing.GetInstance()); ShopClosed.Add(ShopCloseProcessing.GetInstance()); ItemBought.Add(ItemBoughtProcessing.GetInstance()); _isPanelButtonAdded = false; Initialize(); LoadContent(); }
@Override public void Draw(GameTime gameTime) { _sprites.get(0).Draw((SpriteBatch) Game().GetService("SpriteBatch"), _position, Color.WHITE); Clicked.occur(!_isPanelButtonAdded); if (_isPanelButtonAdded) { _itemPanel.Draw(gameTime); } super.Draw(gameTime); }
@Override public void Update(GameTime gameTime) { _delayTime = TimeSpan.Add(_delayTime, gameTime.ElapsedGameTime()); if (_delayTime.miliseconds() <= 100) return; _delayTime = TimeSpan.Zero(); if (_isClicked) { _sprites.get(0).Update(); if (_sprites.get(0).FrameIndex() == 0) { Clicked.Add(DoClick.GetInstance(this)); _isClicked = false; } } super.Update(gameTime); }