Пример #1
0
        public void Draw(SpriteBatch spritebatch)
        {
            for (int i = 0; i < _gemmeAttive.Count; ++i)
            {
                Gemma g = _gemmeAttive[i];

                if (ToBeRemoved(g.Position, g.Width))
                {
                    RemoveGemma(i);
                    --i;
                }
                else
                {
                    g.Draw(spritebatch);
                }
            }

            if (_jalapenos.Active)
            {
                if (ToBeRemoved(_jalapenos.Position, _jalapenos.Width))
                {
                    _jalapenos.Active = false;
                }
                else
                {
                    _jalapenos.Draw(spritebatch);
                }
            }

            if (_broccolo.Active)
            {
                if (ToBeRemoved(_broccolo.Position, _broccolo.Width))
                {
                    _broccolo.Active = false;
                }
                else
                {
                    _broccolo.Draw(spritebatch);
                }
            }

            if (_bean.Active)
            {
                if (ToBeRemoved(_bean.Position, _bean.Width))
                {
                    _bean.Active = false;
                }
                else
                {
                    _bean.Draw(spritebatch);
                }
            }
        }
Пример #2
0
        public GemmaManager(
            Camera cameraReference,
            AssetsLoader assetsLoader)
        {
            _currentCamera = cameraReference;
            _gemmeAttive   = new List <Gemma>();
            _gemmeInactive = new List <Gemma>();

            for (int i = 0; i < MaxGemmeAttive; ++i)
            {
                _gemmeInactive.Add(new Gemma(
                                       assetsLoader.Textures,
                                       assetsLoader.TexturesRectangles["Burger"]));
            }

            _jalapenos = new Gemma(assetsLoader.Textures, assetsLoader.TexturesRectangles["Jalapenos"]);
            _broccolo  = new Gemma(assetsLoader.Textures, assetsLoader.TexturesRectangles["Verdura"]);
            _bean      = new Gemma(assetsLoader.Textures, assetsLoader.TexturesRectangles["Bean"]);
        }