Going to start using Wang tiles
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace Collector.Dimension
|
||||
{
|
||||
public class Autotiling
|
||||
public class WangTile
|
||||
{
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using Collector.ThirdPartyCode;
|
||||
|
||||
namespace Collector.Dimension
|
||||
{
|
||||
public class Chunks
|
||||
public class World
|
||||
{
|
||||
public Dictionary<Tuple<int, int, int>, Blocks> LoadedChunks { get; } = new Dictionary<Tuple<int, int, int>, Blocks>();
|
||||
private readonly Dictionary<Tuple<int, int, int>, Blocks> _savedChunks = new Dictionary<Tuple<int, int, int>, Blocks>();
|
||||
@@ -66,13 +66,6 @@ namespace Collector.Dimension
|
||||
);
|
||||
}
|
||||
}
|
||||
public void CreateStructures() {
|
||||
const int i = 10;
|
||||
SetBlock(3 + i, 2,1,Blocks.BlockWall);
|
||||
SetBlock(4 + i, 2,1,Blocks.BlockWall);
|
||||
SetBlock(3 + i, 3,1, Blocks.BlockRoof);
|
||||
SetBlock(4 + i, 3,1,Blocks.BlockRoof);
|
||||
}
|
||||
|
||||
private void SetBlock(int x, int y, int z, Blocks name)
|
||||
{
|
||||
@@ -109,7 +102,7 @@ namespace Collector.Dimension
|
||||
_savedChunks[tuple] = Blocks.BlockAir;
|
||||
}
|
||||
|
||||
public void UngenerateChunk(float x, float y) {
|
||||
private void UngenerateChunk(float x, float y) {
|
||||
var startX = (int)x << IRestrictions.ChunkShift;
|
||||
var startY = (int)y << IRestrictions.ChunkShift;
|
||||
var endX = startX + IRestrictions.ChunkSize;
|
||||
@@ -125,7 +118,7 @@ namespace Collector.Dimension
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateChunk(float x, float y) {
|
||||
private void GenerateChunk(float x, float y) {
|
||||
var startX = (int)x << IRestrictions.ChunkShift;
|
||||
var startY = (int)y << IRestrictions.ChunkShift;
|
||||
var endX = startX + IRestrictions.ChunkSize;
|
||||
@@ -252,7 +245,7 @@ namespace Collector.Dimension
|
||||
return moisture < 0.66 ? "TropicalSeasonalForest" : "TropicalRainForest";
|
||||
}
|
||||
|
||||
public bool IsEmpty(float x, float y){
|
||||
private bool IsEmpty(float x, float y){
|
||||
return !LoadedChunks.ContainsKey(new Tuple<int,int,int>((int)x * 8, (int)y * 8,0));
|
||||
}
|
||||
}
|
||||
@@ -11,26 +11,26 @@ namespace Collector.Dimension
|
||||
private readonly InputController _inputController;
|
||||
private readonly SpriteBatch _spriteBatch;
|
||||
private readonly Main _main;
|
||||
private readonly Chunks _chunks;
|
||||
private readonly World _world;
|
||||
|
||||
public WorldRenderer(PlayerMouse playerMouse, InputController inputController, SpriteBatch spriteBatch, Main main, Chunks chunks)
|
||||
public WorldRenderer(PlayerMouse playerMouse, InputController inputController, SpriteBatch spriteBatch, Main main, World world)
|
||||
{
|
||||
_playerMouse = playerMouse;
|
||||
_inputController = inputController;
|
||||
_spriteBatch = spriteBatch;
|
||||
_main = main;
|
||||
_chunks = chunks;
|
||||
_chunks.Impassable.Add(Blocks.BlockWater);
|
||||
_chunks.Impassable.Add(Blocks.BlockRoof);
|
||||
_chunks.Impassable.Add(Blocks.BlockWall);
|
||||
_world = world;
|
||||
_world.Impassable.Add(Blocks.BlockWater);
|
||||
_world.Impassable.Add(Blocks.BlockRoof);
|
||||
_world.Impassable.Add(Blocks.BlockWall);
|
||||
}
|
||||
|
||||
private void DrawWorld(SpriteBatch batch, int layer)
|
||||
{
|
||||
foreach (var chunkpair in _chunks.LoadedChunks.Keys.Where(chunkpair => layer==chunkpair.Item3))
|
||||
foreach (var chunkpair in _world.LoadedChunks.Keys.Where(chunkpair => layer==chunkpair.Item3))
|
||||
{
|
||||
batch.Draw(
|
||||
Main.Materials[_chunks.LoadedChunks[chunkpair]],
|
||||
Main.Materials[_world.LoadedChunks[chunkpair]],
|
||||
new Rectangle(
|
||||
chunkpair.Item1,
|
||||
chunkpair.Item2,
|
||||
|
||||
Reference in New Issue
Block a user