parallax effect v1.0

This commit is contained in:
KG0104 2021-10-15 16:35:52 +02:00
parent 7ae3540b2e
commit 1dd4e2a37a
10 changed files with 278 additions and 249 deletions

View File

@ -749,7 +749,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 115516880}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -7.1, y: -2.7, z: 0}
m_LocalPosition: {x: -7.1, y: -22.9, z: 0}
m_LocalScale: {x: 0.3772047, y: 0.3772047, z: 0.3772047}
m_Children: []
m_Father: {fileID: 0}
@ -2938,12 +2938,12 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d8051f3ea1f9294c890e6d3a53d6837, type: 3}
m_Name:
m_EditorClassIdentifier:
begrenzer: {fileID: 1284463699}
limiter: {fileID: 1284463699}
mouse: {fileID: 936765968}
cameraLock: {fileID: 1790915304}
cameraLocked: 0
@ -2998,7 +2998,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -11.8, z: -10}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -3046,6 +3046,7 @@ GameObject:
m_Component:
- component: {fileID: 520214746}
- component: {fileID: 520214745}
- component: {fileID: 520214747}
m_Layer: 0
m_Name: green_idyll_10_l1
m_TagString: Untagged
@ -3097,10 +3098,10 @@ SpriteRenderer:
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 63.57, y: 9.001612}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_DrawMode: 2
m_Size: {x: 180, y: 9.001612}
m_AdaptiveModeThreshold: 0
m_SpriteTileMode: 1
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
@ -3112,12 +3113,27 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 520214744}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.38266373, y: -25.014133, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_LocalPosition: {x: -3.4, y: -17.8, z: 0}
m_LocalScale: {x: 2.000247, y: 4.559183, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 56
m_RootOrder: 54
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &520214747
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 520214744}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6601003bae7365647a2ad4a782940448, type: 3}
m_Name:
m_EditorClassIdentifier:
parallaxEffectMultiplier: {x: 0.4, y: 0.2}
infiniteHorizontal: 1
infiniteVertical: 0
--- !u!1 &522608804
GameObject:
m_ObjectHideFlags: 0
@ -3239,6 +3255,7 @@ GameObject:
m_Component:
- component: {fileID: 547884908}
- component: {fileID: 547884907}
- component: {fileID: 547884909}
m_Layer: 0
m_Name: clouds
m_TagString: Untagged
@ -3285,15 +3302,15 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -3
m_SortingOrder: -4
m_Sprite: {fileID: 21300000, guid: d14b97ffa65dcc248b78639b671311a1, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 38.399998, y: 21.599998}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_DrawMode: 2
m_Size: {x: 240, y: 21.599998}
m_AdaptiveModeThreshold: 0
m_SpriteTileMode: 1
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
@ -3305,12 +3322,27 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 547884906}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -8.9, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_LocalPosition: {x: -1.4, y: -5.4, z: 0}
m_LocalScale: {x: 1.5, y: 1.5, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 54
m_RootOrder: 53
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &547884909
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 547884906}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6601003bae7365647a2ad4a782940448, type: 3}
m_Name:
m_EditorClassIdentifier:
parallaxEffectMultiplier: {x: 0.3, y: 0.1}
infiniteHorizontal: 1
infiniteVertical: 1
--- !u!1 &576194712
GameObject:
m_ObjectHideFlags: 0
@ -10849,88 +10881,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 43
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1052432060
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1052432062}
- component: {fileID: 1052432061}
m_Layer: 0
m_Name: trees
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1052432061
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1052432060}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
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_ReceiveGI: 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: 21300000, guid: f47738cf1366fc6448440e65f0f0e7cb, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 38.399998, y: 21.599998}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1052432062
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1052432060}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -6.5, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 55
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1074149364
GameObject:
m_ObjectHideFlags: 0
@ -11309,6 +11259,104 @@ BoxCollider2D:
serializedVersion: 2
m_Size: {x: 4.7834473, y: 77.39718}
m_EdgeRadius: 0
--- !u!1 &1107259358
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1107259360}
- component: {fileID: 1107259359}
- component: {fileID: 1107259361}
m_Layer: 0
m_Name: green_idyll_10_l3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1107259359
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107259358}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
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_ReceiveGI: 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: -3
m_Sprite: {fileID: 21300000, guid: b196a63655eeede4ead230cebd84c5e5, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 2
m_Size: {x: 180, y: 13.7300005}
m_AdaptiveModeThreshold: 0
m_SpriteTileMode: 1
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1107259360
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107259358}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.6, y: -18.9, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 56
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1107259361
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107259358}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6601003bae7365647a2ad4a782940448, type: 3}
m_Name:
m_EditorClassIdentifier:
parallaxEffectMultiplier: {x: 0.6, y: 0.1}
infiniteHorizontal: 1
infiniteVertical: 0
--- !u!1 &1107270358
GameObject:
m_ObjectHideFlags: 0
@ -20768,7 +20816,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1284463699}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.74, y: -3.6, z: 0}
m_LocalPosition: {x: -69.1, y: -24.7, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -22498,7 +22546,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 5a6911bfdef56e3438469bcb744038a5, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -22518,7 +22566,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1649732364}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -19.9, y: -3.46, z: 0}
m_LocalPosition: {x: -31.5, y: -24.54, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -22726,115 +22774,6 @@ Transform:
m_Father: {fileID: 973671303}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1753423035
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1753423039}
- component: {fileID: 1753423038}
- component: {fileID: 1753423037}
m_Layer: 0
m_Name: cheese (1)
m_TagString: Cheese
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &1753423037
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1753423035}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 9.86, y: 7.85}
newSize: {x: 9.86, y: 7.85}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 9.86, y: 7.85}
m_EdgeRadius: 0
--- !u!212 &1753423038
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1753423035}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
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_ReceiveGI: 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: 21300000, guid: af57138088e06384f8509dd0f35ced49, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 9.86, y: 7.85}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1753423039
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1753423035}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 17.5, y: 16.8, z: 0}
m_LocalScale: {x: 0.3772047, y: 0.3772047, z: 0.3772047}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 53
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1766002208
GameObject:
m_ObjectHideFlags: 0
@ -23393,6 +23332,7 @@ GameObject:
m_Component:
- component: {fileID: 1851206813}
- component: {fileID: 1851206812}
- component: {fileID: 1851206814}
m_Layer: 0
m_Name: green_idyll_10_l2
m_TagString: Untagged
@ -23444,10 +23384,10 @@ SpriteRenderer:
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 56.211063, y: 9.03}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_DrawMode: 2
m_Size: {x: 180, y: 9.03}
m_AdaptiveModeThreshold: 0
m_SpriteTileMode: 1
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
@ -23459,12 +23399,27 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1851206811}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1, y: -19.7, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_LocalPosition: {x: -3.4, y: -18.7, z: 0}
m_LocalScale: {x: 2.1661217, y: 3.4434092, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 57
m_RootOrder: 55
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1851206814
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1851206811}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6601003bae7365647a2ad4a782940448, type: 3}
m_Name:
m_EditorClassIdentifier:
parallaxEffectMultiplier: {x: 0.5, y: 0.1}
infiniteHorizontal: 1
infiniteVertical: 0
--- !u!1 &1856208817
GameObject:
m_ObjectHideFlags: 0

View File

@ -4,15 +4,47 @@ using UnityEngine;
public class Parallaxing : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
[SerializeField] private Vector2 parallaxEffectMultiplier;
[SerializeField] private bool infiniteHorizontal;
[SerializeField] private bool infiniteVertical;
private Transform cameraTransform;
Vector3 lastCameraPosition;
private float textureUnitSizeX;
private float textureUnitSizeY;
private void Start()
{
cameraTransform = Camera.main.transform;
lastCameraPosition = cameraTransform.position;
Sprite sprite = GetComponent<SpriteRenderer>().sprite;
Texture2D texture = sprite.texture;
textureUnitSizeX = texture.width / sprite.pixelsPerUnit;
textureUnitSizeY = texture.height / sprite.pixelsPerUnit;
}
// Update is called once per frame
void Update()
private void LateUpdate()
{
Vector3 deltaMovement = cameraTransform.position - lastCameraPosition;
transform.position += new Vector3(deltaMovement.x * parallaxEffectMultiplier.x, deltaMovement.y * parallaxEffectMultiplier.y);
lastCameraPosition = cameraTransform.position;
if(infiniteVertical)
{
if (Mathf.Abs(cameraTransform.position.x - transform.position.x) >= textureUnitSizeX)
{
float offsetPositionX = (cameraTransform.position.x - transform.position.x) % textureUnitSizeX;
transform.position = new Vector3(cameraTransform.position.x + offsetPositionX, transform.position.y);
}
}
if(infiniteHorizontal)
{
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.x, cameraTransform.position.y + offsetPositionY);
}
}
}
}

View File

@ -4,30 +4,28 @@ using UnityEngine;
public class CameraBehaviour : MonoBehaviour
{
[SerializeField]
GameObject begrenzer;
[SerializeField] GameObject limiter;
[SerializeField]
GameObject mouse;
[SerializeField] GameObject mouse;
[SerializeField]
Transform cameraLock;
[SerializeField] Transform cameraLock;
[HideInInspector]
public bool cameraLocked;
[HideInInspector] public bool cameraLocked;
// Update is called once per frame
void Update()
{
if (mouse.transform.position.x > begrenzer.transform.position.x)
/*if (mouse.transform.position.x > limiter.transform.position.x)
{
transform.position = new Vector3(mouse.transform.position.x, mouse.transform.position.y, -10);
transform.position = new Vector3(transform.position.x, mouse.transform.position.y, -10);
cameraLocked = false;
}
else
{
transform.position = new Vector3(cameraLock.transform.position.x, cameraLock.transform.position.y, -10);
cameraLocked = true;
}
}*/
transform.position = new Vector3(mouse.transform.position.x, -11, -10);
}
}

View File

@ -19,26 +19,22 @@ public class MouseController : MonoBehaviour
public float jumpBufferLength;
private float jumpBufferCounter;
[HideInInspector]
public bool isGrounded;
[HideInInspector] public bool isGrounded;
public Transform groundcheck;
public float checkRadius;
public LayerMask whatIsGround;
PowerUps powerUps;
public bool isFacingLeft;
[HideInInspector] public bool isFacingLeft;
private bool isShooting;
[SerializeField]
GameObject bullet;
[SerializeField] GameObject bullet;
[SerializeField]
Transform bulletSpawnPos;
[SerializeField] Transform bulletSpawnPos;
[SerializeField]
private float shootDelay = 0.5f;
[SerializeField] private float shootDelay = 0.5f;
void Start()
{
@ -152,7 +148,7 @@ public class MouseController : MonoBehaviour
if (! HasReachedTV(acceleration))
{
int oldSign = Math.Sign(rb.velocity.x);
rb.velocity += new Vector2(acceleration * Time.fixedDeltaTime, 0);
rb.velocity += new Vector2(acceleration, 0);
if (HasReachedTV(acceleration))
rb.velocity = new Vector2(Math.Sign(rb.velocity.x) * speed, rb.velocity.y);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 253 KiB

View File

@ -43,7 +43,7 @@ TextureImporter:
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
@ -68,7 +68,55 @@ TextureImporter:
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f47738cf1366fc6448440e65f0f0e7cb
guid: b196a63655eeede4ead230cebd84c5e5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB