From b75ef0d7a11cee9a123d60322160f073eda8c413 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 11 Aug 2018 13:56:57 +0200 Subject: [PATCH] Add hull --- .gitignore | 4 +- .../Ground.physicsMaterial2D | 2 +- .../Ship Material.physicsMaterial2D | 2 +- Assets/Prefabs/Ship.prefab | 67 +++++----- Assets/Scenes/Game.unity | 101 ++++++++------- Assets/Scripts/PlayerMovement.cs | 24 +++- Assets/Sprites/Hull.png | 3 + Assets/Sprites/Hull.png.meta | 121 ++++++++++++++++++ Assets/Sprites/Terrain.png.meta | 2 +- Assets/Sprites/scafo.png | 3 - ProjectSettings/EditorBuildSettings.asset | 7 +- ProjectSettings/GraphicsSettings.asset | 2 + ProjectSettings/UnityConnectSettings.asset | 2 +- 13 files changed, 250 insertions(+), 90 deletions(-) create mode 100644 Assets/Sprites/Hull.png create mode 100644 Assets/Sprites/Hull.png.meta delete mode 100644 Assets/Sprites/scafo.png diff --git a/.gitignore b/.gitignore index ba76045..32261d3 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,6 @@ $RECYCLE.BIN/ *.msp # Windows shortcuts -*.lnk \ No newline at end of file +*.lnk + +*.rar \ No newline at end of file diff --git a/Assets/Physics Materials/Ground.physicsMaterial2D b/Assets/Physics Materials/Ground.physicsMaterial2D index 27519b9..602c52d 100644 --- a/Assets/Physics Materials/Ground.physicsMaterial2D +++ b/Assets/Physics Materials/Ground.physicsMaterial2D @@ -6,5 +6,5 @@ PhysicsMaterial2D: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_Name: Ground - friction: 1000 + friction: 100000 bounciness: 0 diff --git a/Assets/Physics Materials/Ship Material.physicsMaterial2D b/Assets/Physics Materials/Ship Material.physicsMaterial2D index 556aa73..368549a 100644 --- a/Assets/Physics Materials/Ship Material.physicsMaterial2D +++ b/Assets/Physics Materials/Ship Material.physicsMaterial2D @@ -6,5 +6,5 @@ PhysicsMaterial2D: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_Name: Ship Material - friction: 1 + friction: 100000 bounciness: 0 diff --git a/Assets/Prefabs/Ship.prefab b/Assets/Prefabs/Ship.prefab index e9d3f2d..fa6eb2e 100644 --- a/Assets/Prefabs/Ship.prefab +++ b/Assets/Prefabs/Ship.prefab @@ -11,16 +11,16 @@ Prefab: m_SourcePrefab: {fileID: 0} m_RootGameObject: {fileID: 1506768218425990} m_IsPrefabAsset: 1 ---- !u!1 &1384981733096364 +--- !u!1 &1396569450907664 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 6 m_Component: - - component: {fileID: 4464312084781260} - - component: {fileID: 61761689209828930} - - component: {fileID: 212160313355885210} + - component: {fileID: 4419769467158982} + - component: {fileID: 212928515413584804} + - component: {fileID: 60759684842668732} m_Layer: 0 m_Name: Hull m_TagString: Untagged @@ -41,7 +41,7 @@ GameObject: m_Layer: 0 m_Name: Ship m_TagString: Untagged - m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0} + m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 @@ -84,24 +84,24 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1506768218425990} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.568595, y: 35.28643, z: 0} + m_LocalPosition: {x: -4.126, y: 36.531, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4464312084781260} + - {fileID: 4419769467158982} - {fileID: 4516356880908746} - {fileID: 4811992088834386} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4464312084781260 +--- !u!4 &4419769467158982 Transform: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1384981733096364} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -0.52, z: 0} - m_LocalScale: {x: 2.074, y: 0.632, z: 1} + m_GameObject: {fileID: 1396569450907664} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.245, y: -0.382, z: 0} + m_LocalScale: {x: 1.4615, y: 1.4615, z: 1.4615} m_Children: [] m_Father: {fileID: 4279439219186522} m_RootOrder: 0 @@ -113,8 +113,8 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1780907522812474} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.212, y: 0.53, z: 0} - m_LocalScale: {x: 0.37155887, y: 1.4812759, z: 1} + m_LocalPosition: {x: -0.473, y: 1.6165, z: 0} + m_LocalScale: {x: 0.4857389, y: 3.0343938, z: 1} m_Children: [] m_Father: {fileID: 4279439219186522} m_RootOrder: 1 @@ -144,20 +144,20 @@ Rigidbody2D: m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 1 - m_LinearDrag: 0 - m_AngularDrag: 0.05 + m_LinearDrag: 1 + m_AngularDrag: 1 m_GravityScale: 1 m_Material: {fileID: 6200000, guid: 704f912fbe8bba74ebedd5a5f7bff08f, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 ---- !u!61 &61354027027031930 -BoxCollider2D: +--- !u!60 &60759684842668732 +PolygonCollider2D: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1780907522812474} + m_GameObject: {fileID: 1396569450907664} m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} @@ -168,21 +168,24 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1, y: 1} - newSize: {x: 1, y: 1} + oldSize: {x: 2.68, y: 1.3} + newSize: {x: 1.34, y: 0.65} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 1, y: 1} - m_EdgeRadius: 0 ---- !u!61 &61761689209828930 + m_Points: + m_Paths: + - - {x: -1.2726313, y: -0.5143094} + - {x: 0.78310096, y: -0.51465136} + - {x: 1.3078427, y: 0.32390344} + - {x: -1.2722943, y: 0.3283955} +--- !u!61 &61354027027031930 BoxCollider2D: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1384981733096364} + m_GameObject: {fileID: 1780907522812474} m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} @@ -214,7 +217,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: rb: {fileID: 0} - horizontalShipSpeed: 35 + horizontalShipSpeed: 50 verticalShipSpeed: 20 --- !u!212 &212069997133616880 SpriteRenderer: @@ -262,12 +265,12 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!212 &212160313355885210 +--- !u!212 &212928515413584804 SpriteRenderer: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1384981733096364} + m_GameObject: {fileID: 1396569450907664} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -297,12 +300,12 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: be5eaf9abd3481b489d582a8f1a41508, type: 3} - m_Color: {r: 1, g: 0, b: 0, a: 1} + m_Sprite: {fileID: 21300000, guid: 1f841006c9147454d8eca3d3cae86c0f, 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_Size: {x: 1.34, y: 0.65} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index 167f62a..17fc9b8 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -117,7 +117,49 @@ NavMeshSettings: GameObject: m_CorrespondingSourceObject: {fileID: 1506768218425990, guid: 1cf703958a669d942a42326499701367, type: 2} - m_PrefabInternal: {fileID: 1201063087} + m_PrefabInternal: {fileID: 236105087} +--- !u!1001 &236105087 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalPosition.x + value: -4.126 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalPosition.y + value: 36.531 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1cf703958a669d942a42326499701367, type: 2} + m_IsPrefabAsset: 0 --- !u!1001 &391017218 Prefab: m_ObjectHideFlags: 0 @@ -162,6 +204,11 @@ Prefab: propertyPath: target value: objectReference: {fileID: 11493525} + - target: {fileID: 20610604938940038, guid: acb6270a21e7fa744878210a4df90d27, + type: 2} + propertyPath: orthographic size + value: 12 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: acb6270a21e7fa744878210a4df90d27, type: 2} m_IsPrefabAsset: 0 @@ -246,48 +293,16 @@ Prefab: propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: 253220832372043424, guid: 4dc0408b236da9847b1c799161bbd70a, + type: 2} + propertyPath: m_AngularDrag + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 253220832372043424, guid: 4dc0408b236da9847b1c799161bbd70a, + type: 2} + propertyPath: m_LinearDrag + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} m_IsPrefabAsset: 0 ---- !u!1001 &1201063087 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalPosition.x - value: -4.568595 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalPosition.y - value: 35.28643 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 1cf703958a669d942a42326499701367, type: 2} - m_IsPrefabAsset: 0 diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 69ed5b8..80a6833 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -5,8 +5,8 @@ using UnityEngine; public class PlayerMovement : MonoBehaviour { public Rigidbody2D rb; - public float horizontalShipSpeed = 35; - public float verticalShipSpeed = 10; + public float horizontalShipSpeed = 50; + public float verticalShipSpeed = 20; void Start () { rb = GetComponent(); @@ -16,16 +16,30 @@ public class PlayerMovement : MonoBehaviour { if (Input.GetKey(KeyCode.LeftArrow)) { transform.localScale = new Vector3(-1, 1, 1); - rb.AddForce(Vector2.left * horizontalShipSpeed); + if(Input.GetKey(KeyCode.RightShift)) + { + rb.AddTorque(horizontalShipSpeed); + } + else + { + rb.AddForce(Vector2.right * -horizontalShipSpeed); + } } if (Input.GetKey(KeyCode.RightArrow)) { transform.localScale = new Vector3(1, 1, 1); - rb.AddForce(Vector2.right * horizontalShipSpeed); + if (Input.GetKey(KeyCode.RightShift)) + { + rb.AddTorque(-horizontalShipSpeed); + } + else + { + rb.AddForce(Vector2.right * horizontalShipSpeed); + } } if (Input.GetKey(KeyCode.UpArrow)) { - rb.AddForce(Vector2.up * verticalShipSpeed); + rb.AddForce(transform.up * verticalShipSpeed); } } } diff --git a/Assets/Sprites/Hull.png b/Assets/Sprites/Hull.png new file mode 100644 index 0000000..9512153 --- /dev/null +++ b/Assets/Sprites/Hull.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07f2976eb81123d502d98c93e4b5e82f457e13441575c314f60cbd51cfe20f98 +size 17617 diff --git a/Assets/Sprites/Hull.png.meta b/Assets/Sprites/Hull.png.meta new file mode 100644 index 0000000..964033f --- /dev/null +++ b/Assets/Sprites/Hull.png.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 1f841006c9147454d8eca3d3cae86c0f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 7 + 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: 50 + 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: Android + 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: b3934ff69eeac394bb08ceeeafecd89c + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/Terrain.png.meta b/Assets/Sprites/Terrain.png.meta index b70addd..700a139 100644 --- a/Assets/Sprites/Terrain.png.meta +++ b/Assets/Sprites/Terrain.png.meta @@ -31,7 +31,7 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 0 + filterMode: 2 aniso: -1 mipBias: -100 wrapU: 1 diff --git a/Assets/Sprites/scafo.png b/Assets/Sprites/scafo.png deleted file mode 100644 index 474ada1..0000000 --- a/Assets/Sprites/scafo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b810fa86d5c773b6d686e16e039b55d7b22962621d6cfff370bead9de29497e2 -size 26451 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 82ab0f5..d8e4733 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,7 +5,10 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 1 - path: Assets/Scenes/SampleScene.unity + - enabled: 0 + path: Assets/Scenes/MainMenu.unity guid: 2cda990e2423bbf4892e6590ba056729 + - enabled: 1 + path: Assets/Scenes/Game.unity + guid: 0045a14fab245e64a8cb4a8f1ff53902 m_configObjects: {} diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 6c2632a..41ebdca 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -31,6 +31,8 @@ GraphicsSettings: m_AlwaysIncludedShaders: - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset index 3da14d5..1be4600 100644 --- a/ProjectSettings/UnityConnectSettings.asset +++ b/ProjectSettings/UnityConnectSettings.asset @@ -3,7 +3,7 @@ --- !u!310 &1 UnityConnectSettings: m_ObjectHideFlags: 0 - m_Enabled: 0 + m_Enabled: 1 m_TestMode: 0 m_TestEventUrl: m_TestConfigUrl: