From 8f234ae79f50fc0ce725fb87d98110e0d124efef Mon Sep 17 00:00:00 2001 From: Erno Lokkila <eolokk@utu.fi> Date: Sat, 2 Mar 2019 23:15:38 +0200 Subject: [PATCH] sliced quarry and adjusted sprite depths --- .../GroundGenerator/GroundGenerator.cs | 35 +-- Assets/Sprites/quarry.png.meta | 236 ++++++++++++++++++ 2 files changed, 256 insertions(+), 15 deletions(-) create mode 100644 Assets/Sprites/quarry.png.meta diff --git a/Assets/Scripts/GroundGenerator/GroundGenerator.cs b/Assets/Scripts/GroundGenerator/GroundGenerator.cs index c5ff592..0cfec04 100644 --- a/Assets/Scripts/GroundGenerator/GroundGenerator.cs +++ b/Assets/Scripts/GroundGenerator/GroundGenerator.cs @@ -20,6 +20,11 @@ public class GroundGenerator : MonoBehaviour private int stone = 3; private int wood = 4; private int home = 5; + + private int groundDepth = 1; + private int resourceDepth = 0; + private int houseDepth = -2; + private int workerDepth = -1; /* 0,1,2 3,4,5 @@ -77,39 +82,39 @@ public class GroundGenerator : MonoBehaviour if (ground[i - 1, j] == 0 && ground[i, j - 1] == 0) { - spawn(tiles[6], i, j); + spawn(tiles[6], i, j, groundDepth); } else if (ground[i + 1, j] == 0 && ground[i, j - 1] == 0) { - spawn(tiles[8], i, j); + spawn(tiles[8], i, j, groundDepth); } else if (ground[i + 1, j] == 0 && ground[i, j + 1] == 0) { - spawn(tiles[2], i, j); + spawn(tiles[2], i, j, groundDepth); } else if (ground[i - 1, j] == 0 && ground[i, j + 1] == 0) { - spawn(tiles[0], i, j); + spawn(tiles[0], i, j, groundDepth); } else if (ground[i + 1, j] == 0) { - spawn(tiles[5], i, j); + spawn(tiles[5], i, j, groundDepth); } else if (ground[i - 1, j] == 0) { - spawn(tiles[3], i, j); + spawn(tiles[3], i, j, groundDepth); } else if (ground[i, j + 1] == 0) { - spawn(tiles[1], i, j); + spawn(tiles[1], i, j, groundDepth); } else if (ground[i, j - 1] == 0) { - spawn(tiles[7], i, j); + spawn(tiles[7], i, j, groundDepth); } else { - spawn(tiles[4], i, j); + spawn(tiles[4], i, j, groundDepth); } } } @@ -123,15 +128,15 @@ public class GroundGenerator : MonoBehaviour { if (ground[i, j] == wood) { - spawn(resourceGOs[0], i, j, -1); + spawn(resourceGOs[0], i, j, resourceDepth); } if (ground[i, j] == stone) { - spawn(resourceGOs[1], i, j,- 1); + spawn(resourceGOs[1], i, j, resourceDepth); } if (ground[i, j] == food) { - spawn(resourceGOs[2], i, j, -1); + spawn(resourceGOs[2], i, j, resourceDepth); } } } @@ -139,10 +144,10 @@ public class GroundGenerator : MonoBehaviour private void createHome() { ground[ground.GetLength(0) / 2, ground.GetLength(1) / 2] = home; - spawn(homeGO, ground.GetLength(0) / 2, ground.GetLength(1) / 2, 0); - spawn(workerGO, ground.GetLength(0) / 2, ground.GetLength(1) / 2, -3); + spawn(homeGO, ground.GetLength(0) / 2, ground.GetLength(1) / 2, houseDepth); + spawn(workerGO, ground.GetLength(0) / 2, ground.GetLength(1) / 2, workerDepth); } - private GameObject spawn(GameObject go, int x, int y, int z = 1) { + private GameObject spawn(GameObject go, int x, int y, int z) { return Instantiate<GameObject>(go, new Vector3(x, y, z), Quaternion.identity); } } \ No newline at end of file diff --git a/Assets/Sprites/quarry.png.meta b/Assets/Sprites/quarry.png.meta new file mode 100644 index 0000000..3ef87a5 --- /dev/null +++ b/Assets/Sprites/quarry.png.meta @@ -0,0 +1,236 @@ +fileFormatVersion: 2 +guid: 69185a3ed6e033642b69e02c07c3804c +TextureImporter: + fileIDToRecycleName: + 21300000: quarry_0 + 21300002: quarry_1 + 21300004: quarry_2 + 21300006: quarry_3 + 21300008: quarry_4 + 21300010: quarry_5 + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 128 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: quarry_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 5b21b428a81efa343965a917902c626c + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: quarry_1 + rect: + serializedVersion: 2 + x: 128 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 121dca7da97c6e844b93bc231477bbe7 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: quarry_2 + rect: + serializedVersion: 2 + x: 256 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: c263a526c8022ce47a501fd54a54def4 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: quarry_3 + rect: + serializedVersion: 2 + x: 384 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: d46b9cfa4b70ee7419bc4b6b69a4624a + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: quarry_4 + rect: + serializedVersion: 2 + x: 512 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: e1c4d9d6be834a8449502b5c5563c471 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: quarry_5 + rect: + serializedVersion: 2 + x: 640 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: a76034e1a25282847b2c2df920561525 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 82d43787e602dd84287500c180be9b8f + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: -- GitLab