protected override void Draw() { Camera.Update(null); // Clear to the default control background color. Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B); GraphicsDevice.Clear(backColor); g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); PolygonEffect.View = Camera.View; g.GraphicsDevice.DepthStencilState = DepthStencilState.Default; g.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; g.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; foreach (Tile3D ActiveTile in ListTile3D) { PolygonEffect.Texture = ListTileSet[ActiveTile.TilesetIndex]; PolygonEffect.CurrentTechnique.Passes[0].Apply(); ActiveTile.Draw(g.GraphicsDevice); } g.End(); }
public void Draw(CustomSpriteBatch g) { PolygonEffect.View = Camera.View; g.GraphicsDevice.DepthStencilState = DepthStencilState.Default; g.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; g.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; foreach (KeyValuePair <Texture2D, List <Tile3D> > ActiveTileSet in DicTile3D) { PolygonEffect.Texture = ActiveTileSet.Key; PolygonEffect.CurrentTechnique.Passes[0].Apply(); foreach (Tile3D ActiveTile in ActiveTileSet.Value) { ActiveTile.Draw(g.GraphicsDevice); } } PolygonEffect.Texture = sprCursor; PolygonEffect.CurrentTechnique.Passes[0].Apply(); Cursor.Draw(g.GraphicsDevice); g.End(); GameScreen.GraphicsDevice.DepthStencilState = DepthStencilState.Default; for (int P = 0; P < Map.ListPlayer.Count; P++) { //If the selected unit have the order to move, draw the possible positions it can go to. for (int U = 0; U < Map.ListPlayer[P].ListSquad.Count; U++) {//If it's dead, don't draw it unless it's an event unit. if ((Map.ListPlayer[P].ListSquad[U].CurrentLeader == null && !Map.ListPlayer[P].ListSquad[U].IsEventSquad) || Map.ListPlayer[P].ListSquad[U].IsDead) { continue; } Color UnitColor; if (Constants.UnitRepresentationState == Constants.UnitRepresentationStates.Colored) { UnitColor = Map.ListPlayer[P].Color; } else { UnitColor = Color.White; } Map.ListPlayer[P].ListSquad[U].Unit3D.SetViewMatrix(Camera.View); Map.ListPlayer[P].ListSquad[U].Unit3D.SetPosition( -Map.MapSize.X / 2 + 0.5f + Map.ListPlayer[P].ListSquad[U].Position.X, Radius, -Map.MapSize.Y / 2 + 0.5f + Map.ListPlayer[P].ListSquad[U].Y); Map.ListPlayer[P].ListSquad[U].Unit3D.Draw(GameScreen.GraphicsDevice); } } g.Begin(); }
public void Draw(CustomSpriteBatch g, int LayerIndex, bool IsSubLayer, MovementAlgorithmTile[,] ArrayTerrain) { PolygonEffect.View = Camera.View; g.GraphicsDevice.DepthStencilState = DepthStencilState.Default; g.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; g.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; foreach (KeyValuePair <Texture2D, List <Tile3D> > ActiveTileSet in DicTile3D) { PolygonEffect.Texture = ActiveTileSet.Key; PolygonEffect.CurrentTechnique.Passes[0].Apply(); foreach (Tile3D ActiveTile in ActiveTileSet.Value) { ActiveTile.Draw(g.GraphicsDevice); } } PolygonEffect.Texture = sprCursor; PolygonEffect.CurrentTechnique.Passes[0].Apply(); Cursor.Draw(g.GraphicsDevice); g.End(); GameScreen.GraphicsDevice.DepthStencilState = DepthStencilState.Default; for (int P = 0; P < Map.ListPlayer.Count; P++) { Map.ListPlayer[P].GamePiece.Unit3D.SetViewMatrix(Camera.View); Map.ListPlayer[P].GamePiece.Unit3D.SetPosition( -Map.MapSize.X / 2 + 0.5f + Map.ListPlayer[P].GamePiece.Position.X, Radius, -Map.MapSize.Y / 2 + 0.5f + Map.ListPlayer[P].GamePiece.Position.Y); Map.ListPlayer[P].GamePiece.Unit3D.Draw(GameScreen.GraphicsDevice); } g.Begin(); }