From bc79745be653b73a8cec85d3a72b902801ec6ebb Mon Sep 17 00:00:00 2001 From: Francesca Peres Date: Sat, 27 Apr 2019 17:29:37 +0200 Subject: [PATCH] Revert "Merge branch 'master' of https://github.com/Steffo99/LD44" This reverts commit 2f580a9e97efd8b99affd135e5e668feb0d05c67, reversing changes made to ce69c966e10b3b2e598d3841ecaf6e2f3738175d. --- .vscode/launch.json | 39 --- .vscode/settings.json | 56 ---- Assets/{Editor.meta => Animations.meta} | 2 +- .../Map.prefab.meta => Animators.meta} | 5 +- .../{Prefabs/Tile.prefab.meta => Assets.meta} | 5 +- Assets/Editor/BeforeStartAttributeDrawer.cs | 21 -- Assets/PhysMats.meta | 8 + Assets/Prefabs/Map.prefab | 52 ---- Assets/Prefabs/Tile.prefab | 96 ------- Assets/Scenes/Steffo.unity | 69 ----- Assets/Scripts/BeforeStartAttribute.cs | 5 - Assets/Scripts/BeforeStartAttribute.cs.meta | 11 - Assets/Scripts/Consumabile.cs | 32 --- Assets/Scripts/Consumabile.cs.meta | 11 - Assets/Scripts/Map.cs | 259 ------------------ Assets/Scripts/Map.cs.meta | 15 - Assets/Scripts/Mostro.cs | 62 ----- Assets/Scripts/Mostro.cs.meta | 11 - Assets/Scripts/Object.cs.meta | 11 - Assets/Scripts/Player.cs | 56 ---- Assets/Scripts/Player.cs.meta | 11 - Assets/Scripts/{Object.cs => Test.cs} | 4 +- .../Test.cs.meta} | 2 +- Assets/Scripts/Tile.cs | 18 -- Assets/Scripts/Tile.cs.meta | 11 - Assets/Sounds.meta | 8 + Assets/Sprites/PurpleTileset.png.meta | 112 -------- 27 files changed, 25 insertions(+), 967 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json rename Assets/{Editor.meta => Animations.meta} (77%) rename Assets/{Prefabs/Map.prefab.meta => Animators.meta} (57%) rename Assets/{Prefabs/Tile.prefab.meta => Assets.meta} (57%) delete mode 100644 Assets/Editor/BeforeStartAttributeDrawer.cs create mode 100644 Assets/PhysMats.meta delete mode 100644 Assets/Prefabs/Map.prefab delete mode 100644 Assets/Prefabs/Tile.prefab delete mode 100644 Assets/Scripts/BeforeStartAttribute.cs delete mode 100644 Assets/Scripts/BeforeStartAttribute.cs.meta delete mode 100644 Assets/Scripts/Consumabile.cs delete mode 100644 Assets/Scripts/Consumabile.cs.meta delete mode 100644 Assets/Scripts/Map.cs delete mode 100644 Assets/Scripts/Map.cs.meta delete mode 100644 Assets/Scripts/Mostro.cs delete mode 100644 Assets/Scripts/Mostro.cs.meta delete mode 100644 Assets/Scripts/Object.cs.meta delete mode 100644 Assets/Scripts/Player.cs delete mode 100644 Assets/Scripts/Player.cs.meta rename Assets/Scripts/{Object.cs => Test.cs} (75%) rename Assets/{Editor/BeforeStartAttributeDrawer.cs.meta => Scripts/Test.cs.meta} (83%) delete mode 100644 Assets/Scripts/Tile.cs delete mode 100644 Assets/Scripts/Tile.cs.meta create mode 100644 Assets/Sounds.meta delete mode 100644 Assets/Sprites/PurpleTileset.png.meta diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index ca87d3d..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Unity Editor", - "type": "unity", - "path": "/t:/Unity Projects/LD44/Library/EditorInstance.json", - "request": "launch" - }, - { - "name": "Windows Player", - "type": "unity", - "request": "launch" - }, - { - "name": "OSX Player", - "type": "unity", - "request": "launch" - }, - { - "name": "Linux Player", - "type": "unity", - "request": "launch" - }, - { - "name": "iOS Player", - "type": "unity", - "request": "launch" - }, - { - "name": "Android Player", - "type": "unity", - "request": "launch" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4edd970..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "files.exclude": - { - "**/.DS_Store":true, - "**/.git":true, - "**/.gitignore":true, - "**/.gitmodules":true, - "**/*.booproj":true, - "**/*.pidb":true, - "**/*.suo":true, - "**/*.user":true, - "**/*.userprefs":true, - "**/*.unityproj":true, - "**/*.dll":true, - "**/*.exe":true, - "**/*.pdf":true, - "**/*.mid":true, - "**/*.midi":true, - "**/*.wav":true, - "**/*.gif":true, - "**/*.ico":true, - "**/*.jpg":true, - "**/*.jpeg":true, - "**/*.png":true, - "**/*.psd":true, - "**/*.tga":true, - "**/*.tif":true, - "**/*.tiff":true, - "**/*.3ds":true, - "**/*.3DS":true, - "**/*.fbx":true, - "**/*.FBX":true, - "**/*.lxo":true, - "**/*.LXO":true, - "**/*.ma":true, - "**/*.MA":true, - "**/*.obj":true, - "**/*.OBJ":true, - "**/*.asset":true, - "**/*.cubemap":true, - "**/*.flare":true, - "**/*.mat":true, - "**/*.meta":true, - "**/*.prefab":true, - "**/*.unity":true, - "build/":true, - "Build/":true, - "Library/":true, - "library/":true, - "obj/":true, - "Obj/":true, - "ProjectSettings/":true, - "temp/":true, - "Temp/":true - } -} \ No newline at end of file diff --git a/Assets/Editor.meta b/Assets/Animations.meta similarity index 77% rename from Assets/Editor.meta rename to Assets/Animations.meta index b718f6a..b2a79e2 100644 --- a/Assets/Editor.meta +++ b/Assets/Animations.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fd1b080c01a34694793e8f2ff140bfc0 +guid: ef3d86d84c224344a94715cdfa9fe32c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Prefabs/Map.prefab.meta b/Assets/Animators.meta similarity index 57% rename from Assets/Prefabs/Map.prefab.meta rename to Assets/Animators.meta index f5813e2..7ff80b8 100644 --- a/Assets/Prefabs/Map.prefab.meta +++ b/Assets/Animators.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: cd714ea41cb7c454994bf0f5ad99abd1 -PrefabImporter: +guid: 043f304edcc831c4ea9fcf0e1a2e520d +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Prefabs/Tile.prefab.meta b/Assets/Assets.meta similarity index 57% rename from Assets/Prefabs/Tile.prefab.meta rename to Assets/Assets.meta index 493ffc6..4eba494 100644 --- a/Assets/Prefabs/Tile.prefab.meta +++ b/Assets/Assets.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: 0e0b618b5499bbb40b076c0291d55487 -PrefabImporter: +guid: 0460346d99d385241a6d87bbd10aceb8 +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Editor/BeforeStartAttributeDrawer.cs b/Assets/Editor/BeforeStartAttributeDrawer.cs deleted file mode 100644 index 19006b1..0000000 --- a/Assets/Editor/BeforeStartAttributeDrawer.cs +++ /dev/null @@ -1,21 +0,0 @@ -//From https://answers.unity.com/questions/442342/how-to-make-public-variable-read-only-during-run-t.html -using UnityEngine; -using UnityEditor; - -[CustomPropertyDrawer(typeof(BeforeStartAttribute))] -public class BeforeStartAttributeDrawer : PropertyDrawer -{ - // Necessary since some properties tend to collapse smaller than their content - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - return EditorGUI.GetPropertyHeight(property, label, true); - } - - // Draw a disabled property field - public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - { - GUI.enabled = !Application.isPlaying; - EditorGUI.PropertyField(position, property, label, true); - GUI.enabled = true; - } -} \ No newline at end of file diff --git a/Assets/PhysMats.meta b/Assets/PhysMats.meta new file mode 100644 index 0000000..bc5b1b2 --- /dev/null +++ b/Assets/PhysMats.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e823a56cb429e4b49becdc740fba66b9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Map.prefab b/Assets/Prefabs/Map.prefab deleted file mode 100644 index e8043ff..0000000 --- a/Assets/Prefabs/Map.prefab +++ /dev/null @@ -1,52 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &7249059666095778526 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7249059666095778521} - - component: {fileID: 6907631410461015020} - m_Layer: 0 - m_Name: Map - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7249059666095778521 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7249059666095778526} - 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!114 &6907631410461015020 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7249059666095778526} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 052bc569472779a429bfc51246f723d4, type: 3} - m_Name: - m_EditorClassIdentifier: - mapSize: 30 - roomsToGenerate: 5 - wallSprite: {fileID: 21300000, guid: f5be5362b22aa6c48993a720ec6c9b84, type: 3} - roomSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3} - corridorSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3} - tilePrefab: {fileID: 3219556109866242471, guid: 0e0b618b5499bbb40b076c0291d55487, - type: 3} diff --git a/Assets/Prefabs/Tile.prefab b/Assets/Prefabs/Tile.prefab deleted file mode 100644 index 7104d56..0000000 --- a/Assets/Prefabs/Tile.prefab +++ /dev/null @@ -1,96 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &3219556109866242471 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3219556109866242468} - - component: {fileID: 9040756953319481538} - - component: {fileID: 1691311275711631131} - m_Layer: 0 - m_Name: Tile - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3219556109866242468 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3219556109866242471} - 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!114 &9040756953319481538 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3219556109866242471} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4df8012d0534aea47b137c1838a5a6af, type: 3} - m_Name: - m_EditorClassIdentifier: - walkable: 0 - sprite: {fileID: 0} ---- !u!212 &1691311275711631131 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3219556109866242471} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - 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: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_Sprite: {fileID: 0} - 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: 0 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 diff --git a/Assets/Scenes/Steffo.unity b/Assets/Scenes/Steffo.unity index 3b2ac89..ccc28e4 100644 --- a/Assets/Scenes/Steffo.unity +++ b/Assets/Scenes/Steffo.unity @@ -272,72 +272,3 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 4c25f33cb89f6624db48fc49d353a7f2, type: 3} ---- !u!1001 &7249059666254997933 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 7249059666095778526, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_Name - value: Map - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: cd714ea41cb7c454994bf0f5ad99abd1, type: 3} diff --git a/Assets/Scripts/BeforeStartAttribute.cs b/Assets/Scripts/BeforeStartAttribute.cs deleted file mode 100644 index cd1cf30..0000000 --- a/Assets/Scripts/BeforeStartAttribute.cs +++ /dev/null @@ -1,5 +0,0 @@ -using UnityEngine; - -public class BeforeStartAttribute : PropertyAttribute { - -} \ No newline at end of file diff --git a/Assets/Scripts/BeforeStartAttribute.cs.meta b/Assets/Scripts/BeforeStartAttribute.cs.meta deleted file mode 100644 index 68df79c..0000000 --- a/Assets/Scripts/BeforeStartAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ec73aa347f0168f4f95e1acbd3072646 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Consumabile.cs b/Assets/Scripts/Consumabile.cs deleted file mode 100644 index aecdeda..0000000 --- a/Assets/Scripts/Consumabile.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Consumabile : Object -{ - // Start is called before the first frame update - public enum Tipo {Cura, Danno}; - public GameObject player; - public Player player; - public int valore; - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - - void use(){ - if (Tipo == Tipo.Cura){ - player.hp += valore; - if (player.hp >= player.maxhp) player.hp = player.maxhp; - } - if (Tipo == Tipo.Danno){ - player.hp -= valore; - } - } -} diff --git a/Assets/Scripts/Consumabile.cs.meta b/Assets/Scripts/Consumabile.cs.meta deleted file mode 100644 index 26b1684..0000000 --- a/Assets/Scripts/Consumabile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: db5a27c0009da214088bb4a3c08b76db -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Map.cs b/Assets/Scripts/Map.cs deleted file mode 100644 index c86df1e..0000000 --- a/Assets/Scripts/Map.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[System.Serializable] -public class ImpossibleCorridorError : System.Exception -{ - public ImpossibleCorridorError() { } - public ImpossibleCorridorError(string message) : base(message) { } - public ImpossibleCorridorError(string message, System.Exception inner) : base(message, inner) { } - protected ImpossibleCorridorError( - System.Runtime.Serialization.SerializationInfo info, - System.Runtime.Serialization.StreamingContext context) : base(info, context) { } -} - -public class MapRoom { - public readonly Vector2Int start; - public readonly Vector2Int end; - public readonly int mapSize; - - public MapRoom(int mapSize, int maxRoomSize) { - this.mapSize = mapSize; - start = new Vector2Int(Random.Range(0, mapSize), Random.Range(0, mapSize)); - end = new Vector2Int(Random.Range(0, mapSize), Random.Range(0, mapSize)); - if(start.x > end.x) { - int swap = start.x; - start.x = end.x; - end.x = swap; - } - if(start.y > end.y) { - int swap = start.y; - start.y = end.y; - end.y = swap; - } - while(end.x - start.x > maxRoomSize) { - end.x--; - start.x++; - } - while(end.y - start.y > maxRoomSize) { - end.y--; - start.y++; - } - } - - public bool RightCheck() { - return end.x < mapSize-1; - } - - public Vector2Int RightCorridorAttachment() { - return new Vector2Int(end.x+1, Random.Range(start.y, end.y+1)); - } - - public bool LeftCheck() { - return start.x > 0; - } - - public Vector2Int LeftCorridorAttachment() { - return new Vector2Int(start.x-1, Random.Range(start.y, end.y+1)); - } - - public bool TopCheck() { - return end.y < mapSize-1; - } - - public Vector2Int TopCorridorAttachment() { - return new Vector2Int(Random.Range(start.x, end.x+1), end.y+1); - } - - public bool BottomCheck() { - return start.y > 0; - } - - public Vector2Int BottomCorridorAttachment() { - return new Vector2Int(Random.Range(start.x, end.x+1), start.y-1); - } -} - -public enum CorridorModes { - bottomToTop, - topToBottom, - rightToLeft, - leftToRight -} - -public class MapCorridor { - public readonly Vector2Int start; - public readonly Vector2Int end; - public readonly bool horizontal_priority; - - public MapCorridor(MapRoom from, MapRoom to, int mapSize) { - List corridorModes = new List(); - //Find allowed CorridorModes - if(from.end.y <= to.start.y && from.BottomCheck() && to.TopCheck()) corridorModes.Add(CorridorModes.bottomToTop); - if(from.start.y >= to.end.y && from.TopCheck() && to.BottomCheck()) corridorModes.Add(CorridorModes.topToBottom); - if(from.end.x <= to.start.y && from.RightCheck() && to.LeftCheck()) corridorModes.Add(CorridorModes.rightToLeft); - if(from.start.y >= to.end.y && from.LeftCheck() && to.RightCheck()) corridorModes.Add(CorridorModes.leftToRight); - //Select and use a corridor mode - if(corridorModes.Count < 1) throw new ImpossibleCorridorError(); - CorridorModes corridorMode = corridorModes[Random.Range(0, corridorModes.Count)]; - if(corridorMode == CorridorModes.bottomToTop) { - start = from.BottomCorridorAttachment(); - end = to.TopCorridorAttachment(); - } - if(corridorMode == CorridorModes.topToBottom) { - start = from.TopCorridorAttachment(); - end = to.BottomCorridorAttachment(); - } - if(corridorMode == CorridorModes.rightToLeft) { - start = from.RightCorridorAttachment(); - end = to.LeftCorridorAttachment(); - } - if(corridorMode == CorridorModes.leftToRight) { - start = from.LeftCorridorAttachment(); - end = to.RightCorridorAttachment(); - } - //50% - horizontal_priority = Random.Range(0f, 1f) >= 0.5f; - } -} - -public class Map : MonoBehaviour -{ - [BeforeStartAttribute] - public int mapSize = 30; - - [BeforeStartAttribute] - public int roomsToGenerate = 5; - - [BeforeStartAttribute] - public int maxRoomSize = 6; - - [BeforeStartAttribute] - public int maxRoomIterations = 100; - - [BeforeStartAttribute] - public Sprite wallSprite; - - [BeforeStartAttribute] - public Sprite roomSprite; - - [BeforeStartAttribute] - public Sprite corridorSprite; - - [BeforeStartAttribute] - public GameObject tilePrefab; - - private GameObject[,] tiles; - private List rooms; - private System.Random rnd; - - public Tile GetTile(int x, int y) { - GameObject tileObject = tiles[x, y]; - Tile tile = tileObject.GetComponent(); - return tile; - } - - private void InitTile(int x, int y, bool walkable, Sprite tileSprite, bool roomPart) { - Tile tile = GetTile(x, y); - tile.walkable = walkable; - tile.sprite = tileSprite; - tile.roomPart = roomPart; - } - - private void FillWithWalls() { - for(int x = 0; x < mapSize; x++) { - for(int y = 0; y < mapSize; y++) { - GameObject tileObject = Instantiate(tilePrefab, transform); - tileObject.transform.position = new Vector3(x, y, 0); - tiles[x, y] = tileObject; - tileObject.name = "Tile [" + x.ToString() + ", " + y.ToString() + "]"; - Tile tile = tileObject.GetComponent(); - tile.walkable = false; - tile.sprite = wallSprite; - } - } - } - - private void PlaceRoom(MapRoom mr) { - for(int x = mr.start.x; x <= mr.end.x; x++) { - for(int y = mr.start.y; y <= mr.end.y; y++) { - InitTile(x, y, true, roomSprite, true); - } - } - } - - private bool ScanRoom(MapRoom mr) { - //Returns true if the room can be safely placed - for(int x = Mathf.Clamp(mr.start.x-1, 0, mapSize-1); x <= Mathf.Clamp(mr.end.x+1, 0, mapSize-1); x++) { - for(int y = Mathf.Clamp(mr.start.y-1, 0, mapSize-1); y <= Mathf.Clamp(mr.end.y+1, 0, mapSize-1); y++) { - if(GetTile(x, y).roomPart) { - return false; - } - } - } - return true; - } - - private void PlaceCorridor(MapCorridor mc) { - Vector2Int cursor = new Vector2Int(mc.start.x, mc.start.y); - InitTile(cursor.x, cursor.y, true, corridorSprite, false); - if(mc.horizontal_priority) { - while(cursor.x != mc.end.x) { - if(cursor.x > mc.end.x) cursor.x--; - else cursor.x++; - InitTile(cursor.x, cursor.y, true, corridorSprite, false); - } - while(cursor.y != mc.end.y) { - if(cursor.y > mc.end.y) cursor.y--; - else cursor.y++; - InitTile(cursor.x, cursor.y, true, corridorSprite, false); - } - } - else - { - while(cursor.y != mc.end.y) { - if(cursor.y > mc.end.y) cursor.y--; - else cursor.y++; - InitTile(cursor.x, cursor.y, true, corridorSprite, false); - } - while(cursor.x != mc.end.x) { - if(cursor.x > mc.end.x) cursor.x--; - else cursor.x++; - InitTile(cursor.x, cursor.y, true, corridorSprite, false); - } - } - } - - private void GenerateMap() { - FillWithWalls(); - int roomIterations = 0; - while(rooms.Count < roomsToGenerate && roomIterations < maxRoomIterations) { - roomIterations++; - MapRoom room = new MapRoom(mapSize, maxRoomSize); - if(ScanRoom(room)) { - PlaceRoom(room); - rooms.Add(room); - } - if(rooms.Count > 1) { - MapRoom from = rooms[rooms.Count-2]; - MapRoom to = rooms[rooms.Count-1]; - try { - MapCorridor corridor = new MapCorridor(from, to, mapSize); - PlaceCorridor(corridor); - } - catch (ImpossibleCorridorError) {} - } - } - } - - private void Start() - { - //Initialize everything - tiles = new GameObject[mapSize, mapSize]; - rooms = new List(); - rnd = new System.Random(); - //Generate the map - GenerateMap(); - } -} diff --git a/Assets/Scripts/Map.cs.meta b/Assets/Scripts/Map.cs.meta deleted file mode 100644 index 2695166..0000000 --- a/Assets/Scripts/Map.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -guid: 052bc569472779a429bfc51246f723d4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: - - wallSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3} - - roomSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3} - - corridorSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3} - - tilePrefab: {instanceID: 0} - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Mostro.cs b/Assets/Scripts/Mostro.cs deleted file mode 100644 index 467af32..0000000 --- a/Assets/Scripts/Mostro.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Mostro : MonoBehaviour -{ - public string nome; - public Sprite sprite; - public int hpmax, hp, exp; - public bool is_undead; - public enum speed {slow, standard, fast}; - private bool player_spotted; - public Map map; - // Start is called before the first frame update - void Start() - { - map = gameObjectMappa.GetComponent(); - player_spotted = false; - } - - // Update is called once per frame - void Update() - { - if (!player_spotted){ - roam(); - } - //Da mettere il pathfinding per quando trova il personaggio - } - void roam(){ - while (true) - { - int direction = Random.Range(1, 5); - if (direction==1 && is_valid_movement("left")){ - transform.Translate(Vector3.left); - break; - } - else if (direction==2 && is_valid_movement("right")){ - transform.Translate(Vector3.right); - break; - } - else if (direction==3 && is_valid_movement("up")){ - transform.Translate(Vector3.up); - break; - } - else if (is_valid_movement("down")){ - transform.Translate(Vector3.up); - break; - } - } - } - bool is_valid_movement(string direction) - { - Tile tile; - int posX = (int) transform.position.x; - int posY = (int) transform.position.y; - if (direction == "left") tile = map.GetTile(posX - 1, posY); - else if (direction == "right") tile = map.GetTile(posX + 1, posY); - else if (direction == "up") tile = map.GetTile(posX, posY + 1); - else tile = map.GetTile(posX, posY - 1); - return tile.walkable; - } -} diff --git a/Assets/Scripts/Mostro.cs.meta b/Assets/Scripts/Mostro.cs.meta deleted file mode 100644 index 31bb5e3..0000000 --- a/Assets/Scripts/Mostro.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d484827da1a4f984c837dbfb9f970bdd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Object.cs.meta b/Assets/Scripts/Object.cs.meta deleted file mode 100644 index ec349c0..0000000 --- a/Assets/Scripts/Object.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 49be0f8468bff6249b7befdf02bc8ec9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs deleted file mode 100644 index 96900b0..0000000 --- a/Assets/Scripts/Player.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Player : MonoBehaviour -{ - private int exp, level, hp, maxhp; - public int startingHp; - public Map map; - //TODO: Aggiungi gli oggetti in inventario - - // Start is called before the first frame update - void Start() - { - hp = startingHp; - } - - // Update is called once per frame - void Update() - { - playerMovement(); - } - - void playerMovement() - { - if (Input.GetKey(KeyCode.A)) - { - if (is_valid_movement("left")) transform.Translate(Vector3.left); - } - if (Input.GetKey(KeyCode.D)) - { - if (is_valid_movement("right")) transform.Translate(Vector3.right); - } - if (Input.GetKey(KeyCode.W)) - { - if (is_valid_movement("up")) transform.Translate(Vector3.up); - } - if (Input.GetKey(KeyCode.S)) - { - if (is_valid_movement("down")) transform.Translate(Vector3.down); - } - // Qui c'è da aggiungere la condizione per il controllo degli hp - } - - bool is_valid_movement(string direction) - { - Tile tile; - int posX = (int) transform.position.x; - int posY = (int) transform.position.y; - if (direction == "left") tile = map.GetTile(posX - 1, posY); - else if (direction == "right") tile = map.GetTile(posX + 1, posY); - else if (direction == "up") tile = map.GetTile(posX, posY + 1); - else tile = map.GetTile(posX, posY - 1); - return tile.walkable; - } -} diff --git a/Assets/Scripts/Player.cs.meta b/Assets/Scripts/Player.cs.meta deleted file mode 100644 index 4cba488..0000000 --- a/Assets/Scripts/Player.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4de6b97c3d785d146a0df2c1c078fe91 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Object.cs b/Assets/Scripts/Test.cs similarity index 75% rename from Assets/Scripts/Object.cs rename to Assets/Scripts/Test.cs index e01fcdb..2f5a7ab 100644 --- a/Assets/Scripts/Object.cs +++ b/Assets/Scripts/Test.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using UnityEngine; -public class Object : MonoBehaviour +public class Test : MonoBehaviour { - public string nome; - public int costo; // Start is called before the first frame update void Start() { diff --git a/Assets/Editor/BeforeStartAttributeDrawer.cs.meta b/Assets/Scripts/Test.cs.meta similarity index 83% rename from Assets/Editor/BeforeStartAttributeDrawer.cs.meta rename to Assets/Scripts/Test.cs.meta index 4216c56..ef9de0e 100644 --- a/Assets/Editor/BeforeStartAttributeDrawer.cs.meta +++ b/Assets/Scripts/Test.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 13bad693cf0c2634ea1e2be679edf00f +guid: 3a2a8e24cbb5e9a4f88abc3055e15cb7 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Tile.cs b/Assets/Scripts/Tile.cs deleted file mode 100644 index 04dec14..0000000 --- a/Assets/Scripts/Tile.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Tile : MonoBehaviour -{ - public bool walkable; - public bool roomPart; - public Sprite sprite; - - private SpriteRenderer spriteRenderer; - - private void Start() - { - spriteRenderer = GetComponent(); - spriteRenderer.sprite = sprite; - } -} diff --git a/Assets/Scripts/Tile.cs.meta b/Assets/Scripts/Tile.cs.meta deleted file mode 100644 index cb27721..0000000 --- a/Assets/Scripts/Tile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4df8012d0534aea47b137c1838a5a6af -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Sounds.meta b/Assets/Sounds.meta new file mode 100644 index 0000000..5fd147f --- /dev/null +++ b/Assets/Sounds.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19c0d85909aede34bb371863f187b9e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/PurpleTileset.png.meta b/Assets/Sprites/PurpleTileset.png.meta deleted file mode 100644 index 2135d63..0000000 --- a/Assets/Sprites/PurpleTileset.png.meta +++ /dev/null @@ -1,112 +0,0 @@ -fileFormatVersion: 2 -guid: e0e60c9a4ff0b8e429e6cfe316da9bbf -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 10 - 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: -1 - aniso: -1 - mipBias: -100 - 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: 40 - 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: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: 9a9cdb0ef0236d64bbd871c33fd3d927 - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: