diff --git a/Assets/Prefabs/Tiles/doorInner.prefab b/Assets/Prefabs/Tiles/doorInner.prefab index 3f3640d..d738515 100644 --- a/Assets/Prefabs/Tiles/doorInner.prefab +++ b/Assets/Prefabs/Tiles/doorInner.prefab @@ -59,8 +59,8 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 10, y: 10} - newSize: {x: 10, y: 10} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 @@ -84,8 +84,8 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 10, y: 10} - newSize: {x: 10, y: 10} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 @@ -145,7 +145,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 10, y: 10} + m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Prefabs/Tiles/doorOuter.prefab b/Assets/Prefabs/Tiles/doorOuter.prefab index 411185a..aad2537 100644 --- a/Assets/Prefabs/Tiles/doorOuter.prefab +++ b/Assets/Prefabs/Tiles/doorOuter.prefab @@ -59,8 +59,8 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 10, y: 10} - newSize: {x: 10, y: 10} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 @@ -84,8 +84,8 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 10, y: 10} - newSize: {x: 10, y: 10} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 @@ -145,7 +145,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 10, y: 10} + m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Prefabs/Tiles/ground.prefab b/Assets/Prefabs/Tiles/ground0.prefab similarity index 99% rename from Assets/Prefabs/Tiles/ground.prefab rename to Assets/Prefabs/Tiles/ground0.prefab index c87778f..dcb7c9e 100644 --- a/Assets/Prefabs/Tiles/ground.prefab +++ b/Assets/Prefabs/Tiles/ground0.prefab @@ -21,7 +21,7 @@ GameObject: - component: {fileID: 4167595944037000} - component: {fileID: 212910617741009226} m_Layer: 0 - m_Name: ground + m_Name: ground0 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Prefabs/Tiles/ground.prefab.meta b/Assets/Prefabs/Tiles/ground0.prefab.meta similarity index 100% rename from Assets/Prefabs/Tiles/ground.prefab.meta rename to Assets/Prefabs/Tiles/ground0.prefab.meta diff --git a/Assets/Prefabs/Tiles/ground1.prefab b/Assets/Prefabs/Tiles/ground1.prefab new file mode 100644 index 0000000..e23091a --- /dev/null +++ b/Assets/Prefabs/Tiles/ground1.prefab @@ -0,0 +1,87 @@ +%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: 1772182943815902} + m_IsPrefabParent: 1 +--- !u!1 &1772182943815902 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4004370254865002} + - component: {fileID: 212559770023032644} + m_Layer: 0 + m_Name: ground1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4004370254865002 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1772182943815902} + 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 &212559770023032644 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1772182943815902} + 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: 49256f7e236f405479e9486997de5827, 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/ground1.prefab.meta b/Assets/Prefabs/Tiles/ground1.prefab.meta new file mode 100644 index 0000000..03726db --- /dev/null +++ b/Assets/Prefabs/Tiles/ground1.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5ac6ff96b8389a4f89e000bb512df0c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Tiles/ground2.prefab b/Assets/Prefabs/Tiles/ground2.prefab new file mode 100644 index 0000000..a22e3e9 --- /dev/null +++ b/Assets/Prefabs/Tiles/ground2.prefab @@ -0,0 +1,87 @@ +%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: 1292387089709784} + m_IsPrefabParent: 1 +--- !u!1 &1292387089709784 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4651364019093178} + - component: {fileID: 212787770381317586} + m_Layer: 0 + m_Name: ground2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4651364019093178 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1292387089709784} + 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 &212787770381317586 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1292387089709784} + 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: 10d0c9bab26278e4997c44ba3f4833fd, 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/ground2.prefab.meta b/Assets/Prefabs/Tiles/ground2.prefab.meta new file mode 100644 index 0000000..c9a7702 --- /dev/null +++ b/Assets/Prefabs/Tiles/ground2.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ea403377dca91e246a37fc2101f23c5d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Tiles/ground3.prefab b/Assets/Prefabs/Tiles/ground3.prefab new file mode 100644 index 0000000..d23624e --- /dev/null +++ b/Assets/Prefabs/Tiles/ground3.prefab @@ -0,0 +1,87 @@ +%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: 1395236729573066} + m_IsPrefabParent: 1 +--- !u!1 &1395236729573066 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4921335849219796} + - component: {fileID: 212224877339124618} + m_Layer: 0 + m_Name: ground3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4921335849219796 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395236729573066} + 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 &212224877339124618 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395236729573066} + 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: 45575f1a36cb12649a2bb6eaa0f9fcfe, 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/ground3.prefab.meta b/Assets/Prefabs/Tiles/ground3.prefab.meta new file mode 100644 index 0000000..645ca39 --- /dev/null +++ b/Assets/Prefabs/Tiles/ground3.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b27ba92cf33a624ea670c46a3e569b0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index cbc177e..ff3d5fc 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -976,7 +976,7 @@ Prefab: - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} propertyPath: m_AnchoredPosition.x - value: 65.89836 + value: 63.233368 objectReference: {fileID: 0} - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} @@ -1387,7 +1387,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} @@ -1406,6 +1409,7 @@ MonoBehaviour: RockLUR: {fileID: 1938166751346222, guid: 6b83a6a46c57a634fa5085684bad0085, type: 2} RockURD: {fileID: 1437035058628240, guid: 30338afac8ce7054fbff8de89db815e8, type: 2} RockLRD: {fileID: 1251219893662246, guid: e37e0c5d4b013304cbcb32b223264452, type: 2} + Flag: {fileID: 1971451785855062, guid: ff87b9de73979cd40a9853419833a91f, type: 2} playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} ui: {fileID: 1379476069} diff --git a/Assets/Scripts/Door.cs b/Assets/Scripts/Door.cs index a47cee7..65e5489 100644 --- a/Assets/Scripts/Door.cs +++ b/Assets/Scripts/Door.cs @@ -30,7 +30,7 @@ public class Door : MonoBehaviour { public void SetParent(Room room) { this.parent = room; } - + /// /// Locks the door. /// @@ -65,13 +65,15 @@ public class Door : MonoBehaviour { /// private void OnTriggerExit2D(Collider2D collision) { if ( collision.tag == "Player") { - // TODO better checks + Player player = collision.gameObject.GetComponent(); + if ((boundingBox.offset - parent.GetCenter()).sqrMagnitude < ((Vector2) player.transform.position - parent.GetCenter()).sqrMagnitude) + return; Debug.Log("Leaving Trigger"); if(parent == null) { Debug.Log("This door has no parent Room!"); return; } - parent.OnPlayerEnter(collision.gameObject.GetComponent()); + parent.OnPlayerEnter(player); } } } diff --git a/Assets/Scripts/Entities/Player.cs b/Assets/Scripts/Entities/Player.cs index be6a0e1..b4586aa 100644 --- a/Assets/Scripts/Entities/Player.cs +++ b/Assets/Scripts/Entities/Player.cs @@ -80,6 +80,6 @@ public class Player : Mob { protected override void Death() { Debug.Log("Player died..."); Destroy(this.gameObject); - GameController.instance.ChangeState(GameController.GameState.ENDED); + GameController.instance.EndGame(GameController.EndedCause.DIED); } } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 76dd800..0b92843 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -27,7 +27,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] @@ -61,9 +67,11 @@ public class GameController : MonoBehaviour { [SerializeField] GameObject RockLUR; [SerializeField] - GameObject RockURD; + GameObject RockURD; [SerializeField] - GameObject RockLRD; + GameObject RockLRD; + [SerializeField] + GameObject Flag; private Dictionary genPrefabs; private Dictionary enemyPrefabs; @@ -116,10 +124,14 @@ public class GameController : MonoBehaviour { { GenerationProcessor.ExtendedTileType.RockLUD, RockLUD }, { GenerationProcessor.ExtendedTileType.RockLUR, RockLUR }, { GenerationProcessor.ExtendedTileType.RockURD, RockURD }, - { GenerationProcessor.ExtendedTileType.RockLRD, RockLRD }, - { GenerationProcessor.ExtendedTileType.Ground, Ground }, - { GenerationProcessor.ExtendedTileType.DoorInner, DoorInner }, - { GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter } + { GenerationProcessor.ExtendedTileType.RockLRD, RockLRD }, + { GenerationProcessor.ExtendedTileType.Ground0, Ground0 }, + { GenerationProcessor.ExtendedTileType.Ground1, Ground1 }, + { GenerationProcessor.ExtendedTileType.Ground2, Ground2 }, + { GenerationProcessor.ExtendedTileType.Ground3, Ground3 }, + { GenerationProcessor.ExtendedTileType.DoorInner, DoorInner }, + { GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter }, + { GenerationProcessor.ExtendedTileType.Flag, Flag } }; enemyPrefabs = new Dictionary { { Enemy.Enemys.SCORPION, scorpion } @@ -219,9 +231,10 @@ public class GameController : MonoBehaviour { finish.SetDoorsRootObject(doorRootf); finish.Reload(); finish.transform.SetParent(mapRoot.transform); + gp.CreateGOFromType(finish.GetCenter(), 0, Room.TileType.DOOR, GenerationProcessor.ExtendedTileType.Flag, goFinish); - // Other Rooms - foreach (GenRoom gr in dg.rooms) { + // Other Rooms + foreach (GenRoom gr in dg.rooms) { GameObject groom = gp.ProcessRoom(gr.tiles); List ltg = new List(groom.GetComponentsInChildren()); @@ -291,7 +304,8 @@ public class GameController : MonoBehaviour { cam.GetComponent().GameOverBgm(); ui.GetComponent().ShowGameOverUI(); } else if(endCause == EndedCause.WIN) { - //cam.GetComponent().SfxPlay(2); + //cam.GetComponent().SfxPlay(2); + player.InflictDamage(int.MaxValue/2); ui.GetComponent().ShowWinUI(); } } else { @@ -316,6 +330,8 @@ public class GameController : MonoBehaviour { } public void EndGame(EndedCause cause) { + if (endCause != null && state == GameState.ENDED) + return; // Already ended game endCause = cause; ChangeState(GameState.ENDED); } diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index 80db011..63ae5b5 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -432,7 +432,7 @@ public class DungeonGenerator { r.tiles[pos].type = Room.TileType.ROCK; continue; } - float prob2 = 0.02f; + float prob2 = 0.04f; if (UnityEngine.Random.value > 1 - prob2) { r.spawnpoints.Add(pos); diff --git a/Assets/Scripts/Generation/GenerationProcessor.cs b/Assets/Scripts/Generation/GenerationProcessor.cs index 1654080..ddc89a7 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, Flag } 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); @@ -39,10 +39,10 @@ public class GenerationProcessor { return root; } - private GameObject CreateGOFromType(Vector2 v, int rotation, Room.TileType type, ExtendedTileType t, GameObject root) { + public 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/Scripts/Objectives/FinishObjective.cs b/Assets/Scripts/Objectives/FinishObjective.cs index 4a309b5..e5c887e 100644 --- a/Assets/Scripts/Objectives/FinishObjective.cs +++ b/Assets/Scripts/Objectives/FinishObjective.cs @@ -13,7 +13,8 @@ public class FinishObjective : Objective { } public override void UpdateGoal() { - ReachedGoal(); + if ((room.GetCenter() - (Vector2)player.transform.position).magnitude < 2) + ReachedGoal(); } protected override void ReachedGoal() { diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index d15d4db..50ca0c1 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -63,11 +63,20 @@ public class PlayerMovement : MonoBehaviour { //Debug.Log(br); Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false); } - if ( Input.GetAxis("Horizontal") < 0 ) - rb.MoveRotation(rb.rotation + turnSpeed); //transform.Rotate(Vector3.forward * turnSpeed); - if ( Input.GetAxis("Horizontal") > 0 ) - rb.MoveRotation(rb.rotation - turnSpeed); + if (Input.GetAxis("Horizontal") < 0) + { + //rb.rotation += turnSpeed; + rb.MoveRotation(rb.rotation + turnSpeed); + } else + //transform.Rotate(Vector3.forward * turnSpeed); + if (Input.GetAxis("Horizontal") > 0) + { + //rb.rotation -= turnSpeed; + rb.MoveRotation(rb.rotation - turnSpeed); + } else { + rb.MoveRotation(rb.rotation); + } //transform.Rotate(Vector3.forward * -turnSpeed); // Debug lines Debug.DrawLine(transform.position, transform.position + speedVec, Color.magenta, 0.01f, false); diff --git a/Assets/graphics/textures/FixedObjects/Door/doorInner.png b/Assets/graphics/textures/FixedObjects/Door/doorInner.png index ef0e8c1..d25f804 100644 Binary files a/Assets/graphics/textures/FixedObjects/Door/doorInner.png and b/Assets/graphics/textures/FixedObjects/Door/doorInner.png differ diff --git a/Assets/graphics/textures/FixedObjects/Door/doorInner.png.meta b/Assets/graphics/textures/FixedObjects/Door/doorInner.png.meta index d4d94e0..5bf9b96 100644 --- a/Assets/graphics/textures/FixedObjects/Door/doorInner.png.meta +++ b/Assets/graphics/textures/FixedObjects/Door/doorInner.png.meta @@ -1,7 +1,12 @@ fileFormatVersion: 2 guid: c859997db2d488d42a8189791f73e0fb TextureImporter: - fileIDToRecycleName: {} + fileIDToRecycleName: + 21300000: doorInner_0 + 21300002: doorInner_1 + 21300004: doorInner_2 + 21300006: doorInner_3 + 21300008: doorInner_4 externalObjects: {} serializedVersion: 5 mipmaps: @@ -38,9 +43,9 @@ TextureImporter: nPOTScale: 0 lightmap: 0 compressionQuality: 50 - spriteMode: 1 + spriteMode: 2 spriteExtrude: 1 - spriteMeshType: 1 + spriteMeshType: 0 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 1000 @@ -80,7 +85,107 @@ TextureImporter: androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 - sprites: [] + sprites: + - serializedVersion: 2 + name: doorInner_0 + rect: + serializedVersion: 2 + x: 1 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: ff24c891c98e210409333a11c14c9871 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorInner_1 + rect: + serializedVersion: 2 + x: 1001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 7bdb864aee9485148bde8d3cfbbbdc5f + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorInner_2 + rect: + serializedVersion: 2 + x: 2001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: f94cbef5cf2971d44894e9de89fe745f + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorInner_3 + rect: + serializedVersion: 2 + x: 3001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: ca69375da37546d4ebefe163f8eaecf0 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorInner_4 + rect: + serializedVersion: 2 + x: 4001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 658408fbabe66cd4098f1f5cd14458dc + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] diff --git a/Assets/graphics/textures/FixedObjects/Door/doorOuter.png b/Assets/graphics/textures/FixedObjects/Door/doorOuter.png index 6bb130d..eeaf77b 100644 Binary files a/Assets/graphics/textures/FixedObjects/Door/doorOuter.png and b/Assets/graphics/textures/FixedObjects/Door/doorOuter.png differ diff --git a/Assets/graphics/textures/FixedObjects/Door/doorOuter.png.meta b/Assets/graphics/textures/FixedObjects/Door/doorOuter.png.meta index b522d10..3717335 100644 --- a/Assets/graphics/textures/FixedObjects/Door/doorOuter.png.meta +++ b/Assets/graphics/textures/FixedObjects/Door/doorOuter.png.meta @@ -1,7 +1,12 @@ fileFormatVersion: 2 guid: d9380a46a795012449f336288fbd1854 TextureImporter: - fileIDToRecycleName: {} + fileIDToRecycleName: + 21300000: doorOuter_0 + 21300002: doorOuter_1 + 21300004: doorOuter_2 + 21300006: doorOuter_3 + 21300008: doorOuter_4 externalObjects: {} serializedVersion: 5 mipmaps: @@ -38,9 +43,9 @@ TextureImporter: nPOTScale: 0 lightmap: 0 compressionQuality: 50 - spriteMode: 1 + spriteMode: 2 spriteExtrude: 1 - spriteMeshType: 1 + spriteMeshType: 0 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 1000 @@ -80,7 +85,107 @@ TextureImporter: androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 - sprites: [] + sprites: + - serializedVersion: 2 + name: doorOuter_0 + rect: + serializedVersion: 2 + x: 1 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 92fa8f89d0bd20545a9f309dbb60b579 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorOuter_1 + rect: + serializedVersion: 2 + x: 1001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: dcc900c022bf81f4698d78422c95505b + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorOuter_2 + rect: + serializedVersion: 2 + x: 2001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 33bc4d994b6971845931299c722b6092 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorOuter_3 + rect: + serializedVersion: 2 + x: 3001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: b6d2defddd3098d4185e6c978f4fb690 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: doorOuter_4 + rect: + serializedVersion: 2 + x: 4001 + y: 0 + width: 1000 + height: 1000 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 0a609f92ee6fdf94887b453284b21310 + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] 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 diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground2.png b/Assets/graphics/textures/FixedObjects/Ground/ground2.png new file mode 100644 index 0000000..252d3b9 Binary files /dev/null and b/Assets/graphics/textures/FixedObjects/Ground/ground2.png differ diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground2.png.meta b/Assets/graphics/textures/FixedObjects/Ground/ground2.png.meta new file mode 100644 index 0000000..c02f75f --- /dev/null +++ b/Assets/graphics/textures/FixedObjects/Ground/ground2.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 10d0c9bab26278e4997c44ba3f4833fd +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 1000 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e2ba73102b6276e4c966fa0218c4b480 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground3.png b/Assets/graphics/textures/FixedObjects/Ground/ground3.png new file mode 100644 index 0000000..85d08b9 Binary files /dev/null and b/Assets/graphics/textures/FixedObjects/Ground/ground3.png differ diff --git a/Assets/graphics/textures/FixedObjects/Ground/ground3.png.meta b/Assets/graphics/textures/FixedObjects/Ground/ground3.png.meta new file mode 100644 index 0000000..2046a19 --- /dev/null +++ b/Assets/graphics/textures/FixedObjects/Ground/ground3.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 45575f1a36cb12649a2bb6eaa0f9fcfe +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 1000 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c1a6f3db0a300dc458be863b0baac069 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/car.meta b/Assets/graphics/textures/car.meta new file mode 100644 index 0000000..8504594 --- /dev/null +++ b/Assets/graphics/textures/car.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ec323b9157704d00a3409f8ea6e46b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/tmp.meta b/Assets/graphics/textures/tmp.meta new file mode 100644 index 0000000..7ebab68 --- /dev/null +++ b/Assets/graphics/textures/tmp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df6e7833427b5497b92308fb6f54e552 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: