parallax effect v1.0.2
This commit is contained in:
parent
dd018431cf
commit
06404e1102
@ -1933,7 +1933,7 @@ HingeJoint2D:
|
|||||||
m_BreakTorque: Infinity
|
m_BreakTorque: Infinity
|
||||||
m_AutoConfigureConnectedAnchor: 1
|
m_AutoConfigureConnectedAnchor: 1
|
||||||
m_Anchor: {x: 0, y: 0}
|
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_UseMotor: 0
|
||||||
m_Motor:
|
m_Motor:
|
||||||
m_MotorSpeed: 0
|
m_MotorSpeed: 0
|
||||||
@ -15135,7 +15135,7 @@ HingeJoint2D:
|
|||||||
m_BreakTorque: Infinity
|
m_BreakTorque: Infinity
|
||||||
m_AutoConfigureConnectedAnchor: 1
|
m_AutoConfigureConnectedAnchor: 1
|
||||||
m_Anchor: {x: 0, y: 0}
|
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_UseMotor: 0
|
||||||
m_Motor:
|
m_Motor:
|
||||||
m_MotorSpeed: 0
|
m_MotorSpeed: 0
|
||||||
|
@ -19,11 +19,11 @@ public class Parallaxing : MonoBehaviour
|
|||||||
lastCameraPosition = cameraTransform.position;
|
lastCameraPosition = cameraTransform.position;
|
||||||
Sprite sprite = GetComponent<SpriteRenderer>().sprite;
|
Sprite sprite = GetComponent<SpriteRenderer>().sprite;
|
||||||
Texture2D texture = sprite.texture;
|
Texture2D texture = sprite.texture;
|
||||||
textureUnitSizeX = texture.width / sprite.pixelsPerUnit;
|
textureUnitSizeX = (texture.width / sprite.pixelsPerUnit) * transform.localScale.x;
|
||||||
textureUnitSizeY = texture.height / sprite.pixelsPerUnit;
|
textureUnitSizeY = (texture.height / sprite.pixelsPerUnit) * transform.localScale.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LateUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
Vector3 deltaMovement = cameraTransform.position - lastCameraPosition;
|
Vector3 deltaMovement = cameraTransform.position - lastCameraPosition;
|
||||||
transform.position += new Vector3(deltaMovement.x * parallaxEffectMultiplier.x, deltaMovement.y * parallaxEffectMultiplier.y);
|
transform.position += new Vector3(deltaMovement.x * parallaxEffectMultiplier.x, deltaMovement.y * parallaxEffectMultiplier.y);
|
||||||
@ -43,7 +43,7 @@ public class Parallaxing : MonoBehaviour
|
|||||||
if (Mathf.Abs(cameraTransform.position.y - transform.position.y) >= textureUnitSizeY)
|
if (Mathf.Abs(cameraTransform.position.y - transform.position.y) >= textureUnitSizeY)
|
||||||
{
|
{
|
||||||
float offsetPositionY = (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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class KeyHolder : MonoBehaviour
|
public class KeyHolder : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Key followingKey;
|
[HideInInspector] public Key followingKey;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"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.sprite": "1.0.0",
|
||||||
"com.unity.2d.tilemap": "1.0.0",
|
"com.unity.2d.tilemap": "1.0.0",
|
||||||
"com.unity.cinemachine": "2.6.10",
|
"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.rider": "2.0.7",
|
||||||
"com.unity.ide.visualstudio": "2.0.11",
|
"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.test-framework": "1.1.29",
|
||||||
"com.unity.textmeshpro": "3.0.6",
|
"com.unity.textmeshpro": "3.0.6",
|
||||||
"com.unity.timeline": "1.4.8",
|
"com.unity.timeline": "1.4.8",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.2d.animation": {
|
"com.unity.2d.animation": {
|
||||||
"version": "5.0.5",
|
"version": "5.0.8",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -43,10 +43,13 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.collab-proxy": {
|
"com.unity.collab-proxy": {
|
||||||
"version": "1.3.9",
|
"version": "1.13.5",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"com.unity.nuget.newtonsoft-json": "2.0.0",
|
||||||
|
"com.unity.services.core": "1.0.1"
|
||||||
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ext.nunit": {
|
"com.unity.ext.nunit": {
|
||||||
@ -81,8 +84,15 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.com"
|
"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": {
|
"com.unity.render-pipelines.core": {
|
||||||
"version": "10.3.2",
|
"version": "10.6.0",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -91,30 +101,39 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.render-pipelines.universal": {
|
"com.unity.render-pipelines.universal": {
|
||||||
"version": "10.3.2",
|
"version": "10.6.0",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.mathematics": "1.1.0",
|
"com.unity.mathematics": "1.1.0",
|
||||||
"com.unity.render-pipelines.core": "10.3.2",
|
"com.unity.render-pipelines.core": "10.6.0",
|
||||||
"com.unity.shadergraph": "10.3.2"
|
"com.unity.shadergraph": "10.6.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.searcher": {
|
"com.unity.searcher": {
|
||||||
"version": "4.3.1",
|
"version": "4.3.2",
|
||||||
"depth": 2,
|
"depth": 2,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.shadergraph": {
|
"com.unity.services.core": {
|
||||||
"version": "10.3.2",
|
"version": "1.0.1",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.render-pipelines.core": "10.3.2",
|
"com.unity.modules.unitywebrequest": "1.0.0"
|
||||||
"com.unity.searcher": "4.3.1"
|
},
|
||||||
|
"url": "https://packages.unity.com"
|
||||||
|
},
|
||||||
|
"com.unity.shadergraph": {
|
||||||
|
"version": "10.6.0",
|
||||||
|
"depth": 1,
|
||||||
|
"source": "registry",
|
||||||
|
"dependencies": {
|
||||||
|
"com.unity.render-pipelines.core": "10.6.0",
|
||||||
|
"com.unity.searcher": "4.3.2"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 2020.3.1f1
|
m_EditorVersion: 2020.3.21f1
|
||||||
m_EditorVersionWithRevision: 2020.3.1f1 (77a89f25062f)
|
m_EditorVersionWithRevision: 2020.3.21f1 (a38c86f6690f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user