summaryrefslogtreecommitdiff
path: root/Penguloon/Levels/Map.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Levels/Map.cs')
-rw-r--r--Penguloon/Levels/Map.cs42
1 files changed, 40 insertions, 2 deletions
diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs
index f3adf64..03e1c4f 100644
--- a/Penguloon/Levels/Map.cs
+++ b/Penguloon/Levels/Map.cs
@@ -33,6 +33,8 @@ namespace Penguloon.Levels
public LevelBase Level { get; set; }
+ public int SpareTilesY { get; set; }
+
public Map(GameScene parentScene, LevelBase level)
{
this.ParentScene = parentScene;
@@ -56,6 +58,8 @@ namespace Penguloon.Levels
MapWidth = TileWidth * 18;
MapHeight = TileHeight * 13;
+ SpareTilesY = ((int)StaticUIValues.ScreenViewport.Y - MapHeight) / TileHeight; SpareTilesY += 1;
+
WaveManager = new WaveManager(this);
}
@@ -64,9 +68,16 @@ namespace Penguloon.Levels
for (int y = 0; y < TileMap.GetLength(0); y++)
{
for (int x = 0; x < TileMap.GetLength(1); x++)
- {
- Texture2D tileTexture = ContentManager.GetTileTextureByType(TileMap[y, x].Type);
+ {
+ Texture2D tileTexture = null;
+ switch (Level.LevelType)
+ {
+ case LevelType.Ice: tileTexture = ContentManager.GetTileTextureByType(TileMap[y, x].Type); break;
+ case LevelType.Sand: tileTexture = ContentManager.GetSandTileTextureByType(TileMap[y, x].Type); break;
+ }
+
+ if(tileTexture != null)
ParentScene.Main.SpriteBatch.Draw(tileTexture,
destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight));
@@ -76,6 +87,33 @@ namespace Penguloon.Levels
}
}
+ Texture2D tileTextureSpare = null;
+ Texture2D unplaceableTileTexture = null;
+
+ unplaceableTileTexture = ContentManager.GetTexture("UI/unselectableTile");
+
+ switch (Level.LevelType)
+ {
+ case LevelType.Ice: tileTextureSpare = ContentManager.GetTileTextureByType(0); break;
+ case LevelType.Sand: tileTextureSpare = ContentManager.GetSandTileTextureByType(0); break;
+ }
+
+ // draw spare tiles
+ for (int y = 0; y < SpareTilesY; y++)
+ {
+ for (int x = 0; x < TileMap.GetLength(1); x++)
+ {
+ if (tileTextureSpare != null)
+ ParentScene.Main.SpriteBatch.Draw(tileTextureSpare,
+ destinationRectangle: new Rectangle(x * TileWidth, MapHeight + (y * TileHeight), TileWidth, TileHeight));
+
+ if (ParentScene.ObjectSeletor.State == Controls.State.Selected)
+ ParentScene.Main.SpriteBatch.Draw(unplaceableTileTexture,
+ destinationRectangle: new Rectangle(x * TileWidth, MapHeight + (y * TileHeight), TileWidth, TileHeight));
+ }
+ }
+
+
for (int i = 0; i < Enemies.Count; i++)
{
if (Enemies[i].Texture != null)