Browse Source

Added StartSwipe and StopSwipe camera commands.

Swipe mode allows the player to use a swipe gesture to pan the camera
between 2 views.
master
chrisgregan 10 years ago
parent
commit
9693f971fc
  1. 44
      Assets/Fungus/Camera/Commands/StartSwipe.cs
  2. 8
      Assets/Fungus/Camera/Commands/StartSwipe.cs.meta
  3. 27
      Assets/Fungus/Camera/Commands/StopSwipe.cs
  4. 8
      Assets/Fungus/Camera/Commands/StopSwipe.cs.meta
  5. 2
      Assets/Fungus/Camera/Scripts/CameraController.cs

44
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);
}
}
}

8
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:

27
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);
}
}
}

8
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:

2
Assets/Fungus/Camera/Scripts/CameraController.cs

@ -442,7 +442,7 @@ namespace Fungus
Vector3 cameraDelta = Camera.main.ScreenToViewportPoint(delta); Vector3 cameraDelta = Camera.main.ScreenToViewportPoint(delta);
cameraDelta.x *= -2f; cameraDelta.x *= -2f;
cameraDelta.y *= -1f; cameraDelta.y *= -2f;
cameraDelta.z = 0f; cameraDelta.z = 0f;
Vector3 cameraPos = Camera.main.transform.position; Vector3 cameraPos = Camera.main.transform.position;

Loading…
Cancel
Save