1
0
Fork 0

Merge branch 'TriceraptodactylDev'

This commit is contained in:
Triceraptodactyl 2018-04-25 14:00:21 +02:00
commit fb03f163db
3 changed files with 215 additions and 229 deletions

View file

@ -6,6 +6,7 @@ public class GenerationProcessor {
public enum ExtendedTileType {
BorderOuter, BorderInner, BorderSingle, Ground0, Ground1, Ground2, Ground3, DoorInner, DoorOuter, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD, Flag
}
Dictionary<ExtendedTileType, GameObject> prefabs;
public GenerationProcessor(Dictionary<ExtendedTileType, GameObject> prefabs) {
this.prefabs = prefabs;
@ -92,10 +93,7 @@ public class GenerationProcessor {
toCheck = v + new Vector2Int(0, 1);
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type != Room.TileType.WALL)
return 180;
toCheck = v + new Vector2Int(1, 0);
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type != Room.TileType.WALL)
return 90;
break;
case ExtendedTileType.BorderInner:
toCheck = v + new Vector2Int(1, -1);
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type != Room.TileType.WALL)
@ -106,10 +104,7 @@ public class GenerationProcessor {
toCheck = v + new Vector2Int(-1, 1);
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type != Room.TileType.WALL)
return 180;
toCheck = v + new Vector2Int(-1, -1);
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type != Room.TileType.WALL)
return 270;
break;
case ExtendedTileType.BorderOuter:
Vector2Int toCheck1 = v + new Vector2Int(0, -1);
Vector2Int toCheck2 = v + new Vector2Int(-1, 0);
@ -121,10 +116,7 @@ public class GenerationProcessor {
toCheck2 = v + new Vector2Int(1, 0);
if(tiles.ContainsKey(toCheck1) && tiles.ContainsKey(toCheck2) && tiles[toCheck1].type != Room.TileType.WALL && tiles[toCheck2].type != Room.TileType.WALL)
return 90;
toCheck1 = v + new Vector2Int(0, -1);
if(tiles.ContainsKey(toCheck1) && tiles.ContainsKey(toCheck2) && tiles[toCheck1].type != Room.TileType.WALL && tiles[toCheck2].type != Room.TileType.WALL)
return 0;
break;
}
return 0;
}
@ -195,18 +187,15 @@ public class GenerationProcessor {
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
neighbourDoors++;
switch ( neighbourDoors ) {
case 1:
if(neighbourDoors == 1)
return ExtendedTileType.DoorOuter;
default:
return ExtendedTileType.DoorInner;
}
}
private int GetCorrectDoorRotation(ExtendedTileType type, Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
switch ( type ) {
case ExtendedTileType.DoorOuter:
Vector2Int toCheck = position + new Vector2Int(0, -1);
Vector2Int toCheck;
if(type == ExtendedTileType.DoorOuter) {
toCheck = position + new Vector2Int(0, -1);
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
return 270;
toCheck = position + new Vector2Int(-1, 0);
@ -215,14 +204,11 @@ public class GenerationProcessor {
toCheck = position + new Vector2Int(0, 1);
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
return 90;
toCheck = position + new Vector2Int(1, 0);
return 0;
case ExtendedTileType.DoorInner:
Vector2Int toCheckD = position + new Vector2Int(0, -1);
if ( tiles.ContainsKey(toCheckD) && tiles[toCheckD].type == Room.TileType.DOOR )
return 90;
return 0;
}
toCheck = position + new Vector2Int(0, -1);
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
return 90;
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 33 KiB