summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-25 19:09:55 +0800
committerchai <chaifix@163.com>2021-04-25 19:09:55 +0800
commit08b84b4f21e650a1c8694c592442d508abeb39f0 (patch)
treec60cffa4f6a32c672112801c0b14afb17f0f30cf
parentaa8d381cd3265b8b99d27afc33c35f5779f39484 (diff)
+zoomo
-rw-r--r--Assets/LensFlare/CopyRotationValue.cs26
-rw-r--r--Assets/LensFlare/CopyRotationValue.cs.meta11
-rw-r--r--Assets/LensFlare/RotateTransform.cs21
-rw-r--r--Assets/LensFlare/RotateTransform.cs.meta11
-rw-r--r--Assets/LensFlare/SpinInput.cs129
-rw-r--r--Assets/LensFlare/SpinInput.cs.meta11
-rw-r--r--Assets/LensFlare/Zoom.cs47
-rw-r--r--Assets/LensFlare/Zoom.cs.meta11
8 files changed, 267 insertions, 0 deletions
diff --git a/Assets/LensFlare/CopyRotationValue.cs b/Assets/LensFlare/CopyRotationValue.cs
new file mode 100644
index 0000000..f42b896
--- /dev/null
+++ b/Assets/LensFlare/CopyRotationValue.cs
@@ -0,0 +1,26 @@
+//// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com
+
+
+/// CopyRotationValue.cs
+/// Copy the targets transforms rotational value.
+
+using UnityEngine;
+using System.Collections;
+
+namespace ProFlares {
+ public class CopyRotationValue : MonoBehaviour {
+ public Transform target;
+
+ Transform thisTrans;
+ void Start () {
+ thisTrans = transform;
+ if(target == null)
+ this.enabled = false;
+ }
+
+ void LateUpdate () {
+
+ thisTrans.localRotation = target.rotation;
+ }
+ }
+}
diff --git a/Assets/LensFlare/CopyRotationValue.cs.meta b/Assets/LensFlare/CopyRotationValue.cs.meta
new file mode 100644
index 0000000..d2cc490
--- /dev/null
+++ b/Assets/LensFlare/CopyRotationValue.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: caeefc16a0ffc48dd8f63c1c92e16f99
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/LensFlare/RotateTransform.cs b/Assets/LensFlare/RotateTransform.cs
new file mode 100644
index 0000000..2f54743
--- /dev/null
+++ b/Assets/LensFlare/RotateTransform.cs
@@ -0,0 +1,21 @@
+/// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com
+
+using UnityEngine;
+using System.Collections;
+
+public class RotateTransform : MonoBehaviour {
+
+ Transform thisTransform;
+
+ public Vector3 Speed = new Vector3(0,20f,0);
+
+ void Start () {
+ thisTransform = transform;
+ }
+
+ void Update () {
+ Quaternion offset = Quaternion.Euler(Speed * Time.deltaTime);
+ thisTransform.localRotation = thisTransform.localRotation*offset;
+ }
+
+}
diff --git a/Assets/LensFlare/RotateTransform.cs.meta b/Assets/LensFlare/RotateTransform.cs.meta
new file mode 100644
index 0000000..c16fdb5
--- /dev/null
+++ b/Assets/LensFlare/RotateTransform.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1d89303dd8d2742a8aef9c0ad9d88e57
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/LensFlare/SpinInput.cs b/Assets/LensFlare/SpinInput.cs
new file mode 100644
index 0000000..195917f
--- /dev/null
+++ b/Assets/LensFlare/SpinInput.cs
@@ -0,0 +1,129 @@
+/// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com
+
+
+/// <summary>
+/// SpinInput.cs
+/// Rotates a transform based on click dragging. Works on ether X or Y Axis. Y Axis can be limited.
+/// </summary>
+
+using UnityEngine;
+using System.Collections;
+
+namespace ProFlares {
+public class SpinInput : MonoBehaviour {
+
+ private Transform thisTransform;
+
+ float xVerlo;
+
+ float targetVerloX;
+ float lastX;
+ float currentX;
+
+ float offsetX;
+
+ float finalVeloX;
+
+ float tempVeloX;
+
+ float YVerlo;
+
+ float targetVerloY;
+ float lastY;
+ float currentY;
+
+ float offsetY;
+
+ float finalVeloY;
+
+ float tempVeloY;
+
+ public int cropDist = 180;
+
+ public float ResponseTime = 0.2f;
+
+ public bool touchMode = true;
+ void Start () {
+ thisTransform = transform;
+ }
+
+ public bool X;
+
+ public bool Y;
+
+
+ void LateUpdate () {
+
+
+ if(X){
+
+ if(Input.GetMouseButtonDown(0)){
+ // print("MouseDown");
+ lastX = 0;
+ currentX = 0;
+ offsetX = Input.mousePosition.x;
+ }
+
+
+ if(Input.GetMouseButton(0)){
+
+ lastX = currentX;
+ currentX = Input.mousePosition.x-offsetX;
+
+ targetVerloX = (currentX-lastX)*2;
+
+ if((currentX-lastX > 1)||(currentX-lastX < -1)){
+
+ }
+ targetVerloX = targetVerloX*3.5f;
+
+ }else{
+
+ targetVerloX = targetVerloX*0.95f;
+ }
+ finalVeloX = Mathf.Lerp(finalVeloX,targetVerloX,20*Time.deltaTime);
+
+ thisTransform.Rotate(0,finalVeloX*Time.deltaTime,0);
+ }
+
+
+
+ if(Y){
+ if(Input.GetMouseButtonDown(0)){
+ // print("MouseDown");
+ lastY = 0;
+ currentY = 0;
+ offsetY = Input.mousePosition.y;
+ }
+
+ if(Input.GetMouseButton(0)){
+
+ lastY = currentY;
+ currentY = Input.mousePosition.y-offsetY;
+
+ targetVerloY = (currentY-lastY)*-2;
+ targetVerloY = targetVerloY*1.5f;
+
+ }else{
+
+ targetVerloY = targetVerloY*0.95f;
+ }
+
+
+ finalVeloY = Mathf.Lerp(finalVeloY,targetVerloY,20*Time.deltaTime);
+
+
+ thisTransform.Rotate(finalVeloY*Time.deltaTime,0,0);
+
+
+ Quaternion newrotation = thisTransform.rotation;
+
+ newrotation.x = Mathf.Clamp(newrotation.x,-0.1f,0.3f);
+
+ thisTransform.rotation = newrotation;
+
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/LensFlare/SpinInput.cs.meta b/Assets/LensFlare/SpinInput.cs.meta
new file mode 100644
index 0000000..682d0ba
--- /dev/null
+++ b/Assets/LensFlare/SpinInput.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1a921a8497aac47309e350980e0a7cf1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/LensFlare/Zoom.cs b/Assets/LensFlare/Zoom.cs
new file mode 100644
index 0000000..5caece9
--- /dev/null
+++ b/Assets/LensFlare/Zoom.cs
@@ -0,0 +1,47 @@
+/// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com
+
+/// <summary>
+/// Zoom.cs
+/// Attach to a transform, which will then move in on the Z Axis when the mouse wheel is used.
+/// </summary>
+using UnityEngine;
+using System.Collections;
+
+namespace ProFlares{
+ public class Zoom : MonoBehaviour {
+
+ Transform thisTrans;
+
+ public float current;
+
+ public float prev;
+
+ void Start () {
+ thisTrans = transform;
+ }
+
+ public float pos = 0;
+
+ public float dif;
+
+ public float offset;
+
+ void Update () {
+ prev = current;
+ current = Input.GetAxis("Mouse ScrollWheel");
+
+ if(Input.GetKey(KeyCode.UpArrow))
+ current = 0.1f;
+
+ if(Input.GetKey(KeyCode.DownArrow))
+ current = -0.1f;
+
+ dif = (prev-current)*-0.3f;
+ pos = Mathf.Clamp(pos + dif,-1f,1f);
+
+ Vector3 newPos = thisTrans.localPosition;
+ newPos.z = Mathf.Clamp(thisTrans.localPosition.z+current,-2f,3f);
+ thisTrans.localPosition = newPos;
+ }
+ }
+}
diff --git a/Assets/LensFlare/Zoom.cs.meta b/Assets/LensFlare/Zoom.cs.meta
new file mode 100644
index 0000000..3894500
--- /dev/null
+++ b/Assets/LensFlare/Zoom.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7273bde5c1c224e26b0efa033fe287fd
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: