From 06404e1102cf6f5b0b67accf09e8b9ea1af7d8ff Mon Sep 17 00:00:00 2001 From: KG0104 Date: Sat, 23 Oct 2021 17:49:56 +0200 Subject: [PATCH] parallax effect v1.0.2 --- .../(1) Green_Idyll/green_idyll_10.unity | 4 +- .../Assets/Scripts/Background/Parallaxing.cs | 10 ++--- 2DGame/Assets/Scripts/Mouse/KeyHolder.cs | 2 +- 2DGame/Packages/manifest.json | 6 +-- 2DGame/Packages/packages-lock.json | 41 ++++++++++++++----- 2DGame/ProjectSettings/ProjectVersion.txt | 4 +- 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/2DGame/Assets/Scenes/(1) Green_Idyll/green_idyll_10.unity b/2DGame/Assets/Scenes/(1) Green_Idyll/green_idyll_10.unity index df695a0..5cdafa2 100644 --- a/2DGame/Assets/Scenes/(1) Green_Idyll/green_idyll_10.unity +++ b/2DGame/Assets/Scenes/(1) Green_Idyll/green_idyll_10.unity @@ -1933,7 +1933,7 @@ HingeJoint2D: m_BreakTorque: Infinity m_AutoConfigureConnectedAnchor: 1 m_Anchor: {x: 0, y: 0} - m_ConnectedAnchor: {x: 1.5330272, y: 0.000013727693} + m_ConnectedAnchor: {x: 1.5330272, y: 0.000013543291} m_UseMotor: 0 m_Motor: m_MotorSpeed: 0 @@ -15135,7 +15135,7 @@ HingeJoint2D: m_BreakTorque: Infinity m_AutoConfigureConnectedAnchor: 1 m_Anchor: {x: 0, y: 0} - m_ConnectedAnchor: {x: 1.6145648, y: 0.000011488793} + m_ConnectedAnchor: {x: 1.6145648, y: 0.000011680645} m_UseMotor: 0 m_Motor: m_MotorSpeed: 0 diff --git a/2DGame/Assets/Scripts/Background/Parallaxing.cs b/2DGame/Assets/Scripts/Background/Parallaxing.cs index 79fbe94..3abc452 100644 --- a/2DGame/Assets/Scripts/Background/Parallaxing.cs +++ b/2DGame/Assets/Scripts/Background/Parallaxing.cs @@ -19,11 +19,11 @@ public class Parallaxing : MonoBehaviour lastCameraPosition = cameraTransform.position; Sprite sprite = GetComponent().sprite; Texture2D texture = sprite.texture; - textureUnitSizeX = texture.width / sprite.pixelsPerUnit; - textureUnitSizeY = texture.height / sprite.pixelsPerUnit; + textureUnitSizeX = (texture.width / sprite.pixelsPerUnit) * transform.localScale.x; + textureUnitSizeY = (texture.height / sprite.pixelsPerUnit) * transform.localScale.y; } - private void LateUpdate() + private void FixedUpdate() { Vector3 deltaMovement = cameraTransform.position - lastCameraPosition; transform.position += new Vector3(deltaMovement.x * parallaxEffectMultiplier.x, deltaMovement.y * parallaxEffectMultiplier.y); @@ -43,8 +43,8 @@ public class Parallaxing : MonoBehaviour if (Mathf.Abs(cameraTransform.position.y - transform.position.y) >= textureUnitSizeY) { float offsetPositionY = (cameraTransform.position.y - transform.position.y) % textureUnitSizeY; - transform.position = new Vector3(transform.position.y, cameraTransform.position.y + offsetPositionY); + transform.position = new Vector3(transform.position.x, cameraTransform.position.y + offsetPositionY); } } } -} +} \ No newline at end of file diff --git a/2DGame/Assets/Scripts/Mouse/KeyHolder.cs b/2DGame/Assets/Scripts/Mouse/KeyHolder.cs index 1053b5f..72530a0 100644 --- a/2DGame/Assets/Scripts/Mouse/KeyHolder.cs +++ b/2DGame/Assets/Scripts/Mouse/KeyHolder.cs @@ -4,5 +4,5 @@ using UnityEngine; public class KeyHolder : MonoBehaviour { - public Key followingKey; + [HideInInspector] public Key followingKey; } diff --git a/2DGame/Packages/manifest.json b/2DGame/Packages/manifest.json index 1f6f83a..72e0823 100644 --- a/2DGame/Packages/manifest.json +++ b/2DGame/Packages/manifest.json @@ -1,13 +1,13 @@ { "dependencies": { - "com.unity.2d.animation": "5.0.5", + "com.unity.2d.animation": "5.0.8", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.cinemachine": "2.6.10", - "com.unity.collab-proxy": "1.3.9", + "com.unity.collab-proxy": "1.13.5", "com.unity.ide.rider": "2.0.7", "com.unity.ide.visualstudio": "2.0.11", - "com.unity.render-pipelines.universal": "10.3.2", + "com.unity.render-pipelines.universal": "10.6.0", "com.unity.test-framework": "1.1.29", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.4.8", diff --git a/2DGame/Packages/packages-lock.json b/2DGame/Packages/packages-lock.json index b8bf58b..d306001 100644 --- a/2DGame/Packages/packages-lock.json +++ b/2DGame/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { "com.unity.2d.animation": { - "version": "5.0.5", + "version": "5.0.8", "depth": 0, "source": "registry", "dependencies": { @@ -43,10 +43,13 @@ "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "1.3.9", + "version": "1.13.5", "depth": 0, "source": "registry", - "dependencies": {}, + "dependencies": { + "com.unity.nuget.newtonsoft-json": "2.0.0", + "com.unity.services.core": "1.0.1" + }, "url": "https://packages.unity.com" }, "com.unity.ext.nunit": { @@ -81,8 +84,15 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.nuget.newtonsoft-json": { + "version": "2.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.render-pipelines.core": { - "version": "10.3.2", + "version": "10.6.0", "depth": 1, "source": "registry", "dependencies": { @@ -91,30 +101,39 @@ "url": "https://packages.unity.com" }, "com.unity.render-pipelines.universal": { - "version": "10.3.2", + "version": "10.6.0", "depth": 0, "source": "registry", "dependencies": { "com.unity.mathematics": "1.1.0", - "com.unity.render-pipelines.core": "10.3.2", - "com.unity.shadergraph": "10.3.2" + "com.unity.render-pipelines.core": "10.6.0", + "com.unity.shadergraph": "10.6.0" }, "url": "https://packages.unity.com" }, "com.unity.searcher": { - "version": "4.3.1", + "version": "4.3.2", "depth": 2, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.services.core": { + "version": "1.0.1", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.shadergraph": { - "version": "10.3.2", + "version": "10.6.0", "depth": 1, "source": "registry", "dependencies": { - "com.unity.render-pipelines.core": "10.3.2", - "com.unity.searcher": "4.3.1" + "com.unity.render-pipelines.core": "10.6.0", + "com.unity.searcher": "4.3.2" }, "url": "https://packages.unity.com" }, diff --git a/2DGame/ProjectSettings/ProjectVersion.txt b/2DGame/ProjectSettings/ProjectVersion.txt index 6830e2a..d2eb005 100644 --- a/2DGame/ProjectSettings/ProjectVersion.txt +++ b/2DGame/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.1f1 -m_EditorVersionWithRevision: 2020.3.1f1 (77a89f25062f) +m_EditorVersion: 2020.3.21f1 +m_EditorVersionWithRevision: 2020.3.21f1 (a38c86f6690f) -- 2.44.0