public override void Draw(GraphicsDevice device, WorldState world) { //#if !DEBUG if (!Visible || (!world.DrawOOB && (Position.X < -2043 && Position.Y < -2043))) { return; } //#endif if (CutawayHidden) { return; } if (this.DrawGroup != null) { dgrp.Draw(world); } if (Headline != null && !Headline.IsDisposed) { var headOff = new Vector3(0, 0, 0.66f); var headPx = world.WorldSpace.GetScreenFromTile(headOff); var item = world._2D.NewSprite(_2DBatchRenderMode.Z_BUFFER); item.Pixel = Headline; item.Depth = TextureGenerator.GetWallZBuffer(device)[30]; item.SrcRect = new Rectangle(0, 0, Headline.Width, Headline.Height); item.WorldPosition = headOff; var off = PosCenterOffsets[(int)world.Zoom - 1]; item.DestRect = new Rectangle( ((int)headPx.X - Headline.Width / 2) + (int)off.X, ((int)headPx.Y - Headline.Height / 2) + (int)off.Y, Headline.Width, Headline.Height); world._2D.Draw(item); } }
//public override void OnPositionChanged(){ // base.OnPositionChanged(); // if (dgrp != null){ // dgrp.Position = this.Position; // } //} public override void Draw(GraphicsDevice device, WorldState world) { if (this.DrawGroup == null) { return; } //world._2D.Draw(this.DrawGroup); dgrp.Draw(world); }
public override void Draw(GraphicsDevice device, WorldState world) { if (this.DrawGroup == null) { return; } if (!world.TempDraw) { LastScreenPos = world.WorldSpace.GetScreenFromTile(Position) + world.WorldSpace.GetScreenOffset() + PosCenterOffsets[(int)world.Zoom - 1]; LastZoomLevel = (int)world.Zoom; } if (!Visible) { return; } dgrp.Draw(world); if (Headline != null) { var headOff = new Vector3(0, 0, 0.66f); var headPx = world.WorldSpace.GetScreenFromTile(headOff); var item = new _2DSprite(); item.Pixel = Headline; item.Depth = TextureGenerator.GetWallZBuffer(device)[30]; item.RenderMode = _2DBatchRenderMode.Z_BUFFER; item.SrcRect = new Rectangle(0, 0, Headline.Width, Headline.Height); item.WorldPosition = headOff; var off = PosCenterOffsets[(int)world.Zoom - 1]; item.DestRect = new Rectangle( ((int)headPx.X - Headline.Width / 2) + (int)off.X, ((int)headPx.Y - Headline.Height / 2) + (int)off.Y, Headline.Width, Headline.Height); world._2D.Draw(item); } bool forceDynamic = ForceDynamic; if (Container != null && Container is ObjectComponent) { forceDynamic = ((ObjectComponent)Container).ForceDynamic; if (forceDynamic && renderInfo.Layer == WorldObjectRenderLayer.STATIC) { blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OBJECT_GRAPHIC_CHANGE, TileX, TileY, Level, this)); } } if (renderInfo.Layer == WorldObjectRenderLayer.DYNAMIC && !forceDynamic && DynamicCounter++ > 120 && blueprint != null) { blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OBJECT_RETURN_TO_STATIC, TileX, TileY, Level, this)); } }
//public override void OnPositionChanged(){ // base.OnPositionChanged(); // if (dgrp != null){ // dgrp.Position = this.Position; // } //} public override void Draw(GraphicsDevice device, WorldState world) { if (this.DrawGroup == null) { return; } //world._2D.Draw(this.DrawGroup); LastScreenPos = world.WorldSpace.GetScreenFromTile(Position) + world.WorldSpace.GetScreenOffset(); LastZoomLevel = (int)world.Zoom; dgrp.Draw(world); if (renderInfo.Layer == WorldObjectRenderLayer.DYNAMIC && !_ForceDynamic && DynamicCounter++ > 120 && blueprint != null) { blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OBJECT_RETURN_TO_STATIC, TileX, TileY, Level, this)); } }
public override void Draw(GraphicsDevice device, WorldState world) { //#if !DEBUG if (!Visible || (!world.DrawOOB && (Position.X < -2043 && Position.Y < -2043))) { return; } //#endif if (CutawayHidden) { return; } if (this.DrawGroup != null) { dgrp.Draw(world); } if (Headline != null && !Headline.IsDisposed) { var headOff = new Vector3(0, 0, 0.66f); var headPx = world.WorldSpace.GetScreenFromTile(headOff); var item = world._2D.NewSprite(_2DBatchRenderMode.Z_BUFFER); item.Pixel = Headline; item.Depth = TextureGenerator.GetWallZBuffer(device)[30]; item.SrcRect = new Rectangle(0, 0, Headline.Width, Headline.Height); item.WorldPosition = headOff; var off = PosCenterOffsets[(int)world.Zoom - 1]; item.DestRect = new Rectangle( ((int)headPx.X - Headline.Width / 2) + (int)off.X, ((int)headPx.Y - Headline.Height / 2) + (int)off.Y, Headline.Width, Headline.Height); world._2D.Draw(item); } for (int i = 0; i < Particles.Count; i++) { var part = Particles[i]; if (part.BoundsDirty && part.AutoBounds && dgrp != null) { //this particle needs updated bounds. BoundingBox bounds; if (ShadowComponent != null) { bounds = ShadowComponent.GetParticleBounds(); } else { bounds = GetParticleBounds(); } part.Volume = bounds; part.BoundsDirty = false; part.Dispose(); } part.Level = Level; part.OwnerWorld = Matrix.CreateScale(3) * World * Matrix.CreateTranslation(1.5f, 0, 1.5f) * Matrix.CreateScale(2); if (part.Dead) { Particles.RemoveAt(i--); } } }