Beispiel #1
0
        public void Draw(GameTime gameTime)
        {
            EntityTemplate model = FrmEntitySelector.Instance.selectedEntity;

            if (model != null && entered)
            {
                MapEntity entity = model.CreateEntity(EditorEngine.Instance.World.EntityFactory, true);

                entity.Opacity  = .5f;
                entity.Color    = Color.LightGray;
                entity.Position = new Vector2(xt * 16, yt * 16);
                entity.Shadow   = false;

                entity.Draw(gameTime);
            }
        }
Beispiel #2
0
        public override void Draw(GameTime time)
        {
            SpriteBatch batch = EditorEngine.Instance.World.ViewData.SpriteBatch;

            List <Rectangle> collisions = getEntityBounds().ToList();
            int index = 0;

            foreach (EntityTemplate tmp in EditorEngine.Instance.World.EntityContainer.GetBuildings())
            {
                MapEntity e = tmp.CreateEntity(EditorEngine.Instance.World.EntityFactory, false);

                if (e != null)
                {
                    e.Position = new Vector2(collisions[index].X, collisions[index].Y - scrolling.Value);

                    e.BeginDraw(time);
                    e.Draw(time);
                    e.EndDraw(time);

                    //cute stuff!
                    if (tmp == selectedEntity)
                    {
                        MapEntity e2 = tmp.CreateEntity(EditorEngine.Instance.World.EntityFactory, false);

                        e2.Position = new Vector2(collisions[index].X, collisions[index].Y - scrolling.Value);

                        e2.Color      = Color.White;
                        e2.Opacity    = 0.5f;
                        e2.Shadow     = false;
                        e2.blendstate = BlendState.Additive;

                        e2.BeginDraw(time);
                        e2.Draw(time);
                        e2.EndDraw(time);
                    }
                    index++;
                }
            }

            base.Draw(time);
        }
        private void drawOverlay(MapEntity worldEntity, GameTime gameTime)
        {
            SpriteBatch spriteBatch = EditorEngine.Instance.World.ViewData.SpriteBatch;
            float       opacity     = worldEntity.Opacity;
            bool        shadow      = worldEntity.Shadow;

            worldEntity.Opacity    = 0.5f;
            worldEntity.Shadow     = false;
            worldEntity.blendstate = BlendState.Additive;

            spriteBatch.End();

            worldEntity.BeginDraw(gameTime);
            worldEntity.Draw(gameTime);
            worldEntity.EndDraw(gameTime);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);

            worldEntity.Opacity    = opacity;
            worldEntity.Shadow     = shadow;
            worldEntity.blendstate = BlendState.NonPremultiplied;
        }