diff --git a/Assets/Prefabs/Tiles/ground.prefab b/Assets/Prefabs/Tiles/ground.prefab deleted file mode 100644 index c87778f..0000000 --- a/Assets/Prefabs/Tiles/ground.prefab +++ /dev/null @@ -1,87 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1487413182883822} - m_IsPrefabParent: 1 ---- !u!1 &1487413182883822 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4167595944037000} - - component: {fileID: 212910617741009226} - m_Layer: 0 - m_Name: ground - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4167595944037000 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1487413182883822} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &212910617741009226 -SpriteRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1487413182883822} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 4294967295 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 1778783263 - m_SortingLayer: -2 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 79d2e82f1d7398f41aa2dd6501e9d21c, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1, y: 1} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 diff --git a/Assets/Prefabs/Tiles/ground.prefab.meta b/Assets/Prefabs/Tiles/ground.prefab.meta deleted file mode 100644 index 2d9395b..0000000 --- a/Assets/Prefabs/Tiles/ground.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bc8a58beb0459094483211a5c7933959 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 100100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index d1fe0d9..a3de4aa 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -1245,7 +1245,10 @@ MonoBehaviour: type: 2} BorderSingle: {fileID: 1277252496101342, guid: ed9537580662f6046a1514a4c5bfdd98, type: 2} - Ground: {fileID: 1487413182883822, guid: bc8a58beb0459094483211a5c7933959, type: 2} + Ground0: {fileID: 1487413182883822, guid: bc8a58beb0459094483211a5c7933959, type: 2} + Ground1: {fileID: 1772182943815902, guid: d5ac6ff96b8389a4f89e000bb512df0c, type: 2} + Ground2: {fileID: 1292387089709784, guid: ea403377dca91e246a37fc2101f23c5d, type: 2} + Ground3: {fileID: 1395236729573066, guid: 2b27ba92cf33a624ea670c46a3e569b0, type: 2} DoorInner: {fileID: 1065161683117842, guid: 06aa81f4fbf9a3a4a8f9fdadafcbf7fa, type: 2} DoorOuter: {fileID: 1575370008060226, guid: 70bf9bb227285e74383db2dc84cc6c50, type: 2} Rock: {fileID: 1373919933116942, guid: 5f26192f79d542e49ad24fadc39f5654, type: 2} diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 83e6bce..bf1e5d7 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -22,7 +22,13 @@ public class GameController : MonoBehaviour { [SerializeField] GameObject BorderSingle; [SerializeField] - GameObject Ground; + GameObject Ground0; + [SerializeField] + GameObject Ground1; + [SerializeField] + GameObject Ground2; + [SerializeField] + GameObject Ground3; [SerializeField] GameObject DoorInner; [SerializeField] @@ -111,7 +117,10 @@ public class GameController : MonoBehaviour { genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLUR, RockLUR); genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockURD, RockURD); genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLRD, RockLRD); - genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground, Ground); + genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground0, Ground0); + genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground1, Ground1); + genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground2, Ground2); + genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground3, Ground3); genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorInner, DoorInner); genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter); } diff --git a/Assets/Scripts/Generation/GenerationProcessor.cs b/Assets/Scripts/Generation/GenerationProcessor.cs index 1654080..19bf598 100644 --- a/Assets/Scripts/Generation/GenerationProcessor.cs +++ b/Assets/Scripts/Generation/GenerationProcessor.cs @@ -4,7 +4,7 @@ using UnityEngine; public class GenerationProcessor { public enum ExtendedTileType { - BorderOuter, BorderInner, BorderSingle, Ground, DoorInner, DoorOuter, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD + 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 } Dictionary prefabs; public GenerationProcessor(Dictionary prefabs) { @@ -16,7 +16,7 @@ public class GenerationProcessor { name = "Room" }; foreach ( Vector2Int v in tiles.Keys ) { - ExtendedTileType type = ExtendedTileType.Ground; + ExtendedTileType type = GetRandomGroundType(); int rotation = 0; switch ( tiles[v].type ) { case Room.TileType.WALL: @@ -24,7 +24,7 @@ public class GenerationProcessor { rotation = GetCorrectWallRotation(type, tiles[v].position); break; case Room.TileType.GROUND: - type = ExtendedTileType.Ground; + type = GetRandomGroundType(); break; case Room.TileType.DOOR: type = GetCorrectDoorType(tiles, v); @@ -42,7 +42,7 @@ public class GenerationProcessor { private GameObject CreateGOFromType(Vector2 v, int rotation, Room.TileType type, ExtendedTileType t, GameObject root) { GameObject tmp = null; if (type != Room.TileType.GROUND) - CreateGOFromType(v, 0, Room.TileType.GROUND, ExtendedTileType.Ground, root); + CreateGOFromType(v, 0, Room.TileType.GROUND, GetRandomGroundType(), root); if ( prefabs.ContainsKey(t) && root != null ) { tmp = Object.Instantiate(prefabs[t], root.transform); tmp.transform.position = v; @@ -194,7 +194,6 @@ public class GenerationProcessor { return 90; toCheck = position + new Vector2Int(1, 0); return 0; - break; case ExtendedTileType.DoorInner: Vector2Int toCheckD = position + new Vector2Int(0, -1); if(tiles.ContainsKey(toCheckD) && tiles[toCheckD].type == Room.TileType.DOOR) @@ -203,4 +202,18 @@ public class GenerationProcessor { } return 0; } + + private ExtendedTileType GetRandomGroundType() { + int num = (int) (UnityEngine.Random.value * 4); + switch(num) { + case 0: + return ExtendedTileType.Ground0; + case 1: + return ExtendedTileType.Ground1; + case 2: + return ExtendedTileType.Ground2; + default: + return ExtendedTileType.Ground3; + } + } } diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground0.png b/Assets/graphics/textures/FixedObjects/Ground/ground0.png index 17fd49d..92ab084 100644 Binary files a/Assets/graphics/textures/FixedObjects/Ground/ground0.png and b/Assets/graphics/textures/FixedObjects/Ground/ground0.png differ diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground1.png b/Assets/graphics/textures/FixedObjects/Ground/ground1.png index 5937a18..4f1e4e1 100644 Binary files a/Assets/graphics/textures/FixedObjects/Ground/ground1.png and b/Assets/graphics/textures/FixedObjects/Ground/ground1.png differ