diff --git a/Assets/Fungus/Camera/Commands/StartSwipe.cs b/Assets/Fungus/Camera/Commands/StartSwipe.cs new file mode 100644 index 00000000..3f554e0b --- /dev/null +++ b/Assets/Fungus/Camera/Commands/StartSwipe.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using System; +using System.Collections; + +namespace Fungus +{ + [CommandInfo("Camera", + "Start Swipe", + "Activates swipe panning mode where the player can pan the camera within the area between viewA & viewB.")] + public class StartSwipe : Command + { + public View viewA; + public View viewB; + public float duration = 0.5f; + + public override void OnEnter() + { + CameraController cameraController = CameraController.GetInstance(); + + cameraController.StartSwipePan(viewA, viewB, duration, () => Continue() ); + } + + public override string GetSummary() + { + if (viewA == null) + { + return "Error: No view selected for View A"; + } + + if (viewB == null) + { + return "Error: No view selected for View B"; + } + + return viewA.name + " to " + viewB.name; + } + + public override Color GetButtonColor() + { + return new Color32(216, 228, 170, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/Camera/Commands/StartSwipe.cs.meta b/Assets/Fungus/Camera/Commands/StartSwipe.cs.meta new file mode 100644 index 00000000..177a4fec --- /dev/null +++ b/Assets/Fungus/Camera/Commands/StartSwipe.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 893af7b9a2a87449e9bb197699aa46b5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/Camera/Commands/StopSwipe.cs b/Assets/Fungus/Camera/Commands/StopSwipe.cs new file mode 100644 index 00000000..a1f2df31 --- /dev/null +++ b/Assets/Fungus/Camera/Commands/StopSwipe.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System; +using System.Collections; + +namespace Fungus +{ + [CommandInfo("Camera", + "Stop Swipe", + "Deactivates swipe panning mode.")] + public class StopSwipe : Command + { + public override void OnEnter() + { + CameraController cameraController = CameraController.GetInstance(); + + cameraController.StopSwipePan(); + + Continue(); + } + + public override Color GetButtonColor() + { + return new Color32(216, 228, 170, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/Camera/Commands/StopSwipe.cs.meta b/Assets/Fungus/Camera/Commands/StopSwipe.cs.meta new file mode 100644 index 00000000..568fb093 --- /dev/null +++ b/Assets/Fungus/Camera/Commands/StopSwipe.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e862766e64934bd1987a5ce891d04fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/Camera/Scripts/CameraController.cs b/Assets/Fungus/Camera/Scripts/CameraController.cs index f5a6a052..90c335c4 100644 --- a/Assets/Fungus/Camera/Scripts/CameraController.cs +++ b/Assets/Fungus/Camera/Scripts/CameraController.cs @@ -442,7 +442,7 @@ namespace Fungus Vector3 cameraDelta = Camera.main.ScreenToViewportPoint(delta); cameraDelta.x *= -2f; - cameraDelta.y *= -1f; + cameraDelta.y *= -2f; cameraDelta.z = 0f; Vector3 cameraPos = Camera.main.transform.position;