diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
index 0e4f7f7d1..eff0a642f 100644
--- a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
+++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
@@ -9,6 +9,7 @@
+
diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj
index f87f22678..8b45b222f 100644
--- a/Assembly-CSharp.csproj
+++ b/Assembly-CSharp.csproj
@@ -60,6 +60,7 @@
+
diff --git a/Assets/DragHandler.cs b/Assets/DragHandler.cs
new file mode 100644
index 000000000..b21731675
--- /dev/null
+++ b/Assets/DragHandler.cs
@@ -0,0 +1,22 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class DragHandler : MonoBehaviour
+{
+ public Camera Camera;
+ public float Scaling;
+ private Vector2 _previousPosition;
+
+ void Update()
+ {
+ var newPosition = Camera.ScreenToWorldPoint(Input.mousePosition);
+ if(Input.GetMouseButtonDown(0))
+ _previousPosition = newPosition;
+ if (Input.GetMouseButton(0))
+ {
+ Camera.transform.position -= (Vector3)((Vector2) newPosition - _previousPosition);
+ }
+
+ }
+}
diff --git a/Assets/DragHandler.cs.meta b/Assets/DragHandler.cs.meta
new file mode 100644
index 000000000..b2513cf98
--- /dev/null
+++ b/Assets/DragHandler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d172604daaa352b4784c662883d40ec9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Materials/Background.mat b/Assets/Materials/Background.mat
index 704800d0b..d9c1a516d 100644
--- a/Assets/Materials/Background.mat
+++ b/Assets/Materials/Background.mat
@@ -63,6 +63,7 @@ Material:
- NoiseLacunarity: 2.5
- NoiseOffset: 0.35
- NoisePosition: 0
+ - Parallax: -0.2
- ScrollSpeed: 2
- Speed: 5
- _BumpScale: 1
@@ -83,6 +84,7 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
+ - ParallaxDirection: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 0, g: 0.12804878, b: 0.25, a: 1}
- _Color2: {r: 0.15, g: 0, b: 0.0077922107, a: 1}
diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity
index 1c3e56068..83ac96544 100644
--- a/Assets/Scenes/Main.unity
+++ b/Assets/Scenes/Main.unity
@@ -4605,6 +4605,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 04277e392af12204397c334ea824f957, type: 3}
m_Name:
m_EditorClassIdentifier:
+ FollowCamera: {fileID: 519420031}
BackgroundMaterial: {fileID: 2100000, guid: 90cead50364300d47bb35194fb52c117, type: 2}
GravityTexture: {fileID: 0}
GravityRenderer: {fileID: 1956833085}
@@ -6133,6 +6134,66 @@ MonoBehaviour:
m_FlexibleWidth: 1
m_FlexibleHeight: -1
m_LayoutPriority: 1
+--- !u!1 &565356060
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 565356062}
+ - component: {fileID: 565356061}
+ - component: {fileID: 565356063}
+ m_Layer: 0
+ m_Name: DragHandler
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &565356061
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 565356060}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d172604daaa352b4784c662883d40ec9, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Camera: {fileID: 519420031}
+ Scaling: 0
+--- !u!4 &565356062
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 565356060}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 267.06277, y: 296.29117, z: -7.232751}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 7
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &565356063
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 565356060}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 5f60c7818169f95468915fbca3ef4773, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ TabGroup: {fileID: 143833105}
+ TabButton: {fileID: 618245060}
--- !u!1 &569230930
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/BackgroundRenderer.cs b/Assets/Scripts/BackgroundRenderer.cs
index cc373214e..5470401b7 100644
--- a/Assets/Scripts/BackgroundRenderer.cs
+++ b/Assets/Scripts/BackgroundRenderer.cs
@@ -10,19 +10,19 @@ public class BackgroundRenderer : MonoBehaviour
// public float RotationSpeed2 = 1;
private Camera _camera;
private float _ratio;
- //private Material _material;
+ private Material _material;
private float _depth;
private void Start()
{
_camera = GetComponent();
_depth = Background.position.z;
- //_material = Background.GetComponent().material;
+ _material = Background.GetComponent().material;
}
private void OnPreRender()
{
- //_material.SetVector("Rot1", );
+ _material.SetVector("ParallaxDirection", transform.position);
_ratio = (float) Screen.height / Screen.width;
Background.position = new Vector3(transform.position.x, transform.position.y, _depth);
var size = _camera.orthographicSize;
diff --git a/Assets/Scripts/ZoneRenderer.cs b/Assets/Scripts/ZoneRenderer.cs
index 904c281eb..7ecc8aa58 100644
--- a/Assets/Scripts/ZoneRenderer.cs
+++ b/Assets/Scripts/ZoneRenderer.cs
@@ -5,6 +5,7 @@ using UnityEngine;
public class ZoneRenderer : MonoBehaviour
{
+ public Camera FollowCamera;
public Material BackgroundMaterial;
public RenderTexture GravityTexture;
public MeshRenderer GravityRenderer;
@@ -20,6 +21,7 @@ public class ZoneRenderer : MonoBehaviour
private void OnPreRender()
{
+ _camera.transform.position = FollowCamera.transform.position;
if (Screen.width != _resX || Screen.height != _resY)
{
_resX = Screen.width;
diff --git a/Assets/Shaders/Background.shader b/Assets/Shaders/Background.shader
index 54de991b6..893c98d59 100644
--- a/Assets/Shaders/Background.shader
+++ b/Assets/Shaders/Background.shader
@@ -14,6 +14,8 @@
Speed("Speed", Float) = 1
ScrollSpeed("ScrollSpeed", Float) = 1
Distortion("Distortion", Float) = 1
+ ParallaxDirection("ParallaxDirection", Vector) = (0,0,0,0)
+ Parallax("Parallax", Float) = 1
}
SubShader
@@ -57,6 +59,8 @@
float Speed;
float ScrollSpeed;
float Distortion;
+ float2 ParallaxDirection;
+ float Parallax;
v2f vert (appdata v)
{
@@ -70,10 +74,12 @@
float fbm(float2 p)
{
float freq = NoiseFrequency, amp = .5;
+ float parallax = Parallax;
float sum = 0;
for(int i = 0; i < 4; i++)
{
- sum += snoise(p * freq) * amp;
+ sum += snoise(p * freq + Parallax * ParallaxDirection) * amp;
+ parallax /= NoiseLacunarity;
freq *= NoiseLacunarity;
amp *= NoiseGain;
}
@@ -84,10 +90,12 @@
float2 fbmgrad(float2 p)
{
float freq = NoiseFrequency, amp = .5;
+ float parallax = Parallax;
float2 sum = 0;
for(int i = 0; i < 4; i++)
{
- sum += snoise_grad(p * freq) * amp;
+ sum += snoise_grad(p * freq + Parallax * ParallaxDirection) * amp;
+ parallax /= NoiseLacunarity;
freq *= NoiseLacunarity;
amp *= NoiseGain;
}