Browse Source
Swipe mode allows the player to use a swipe gesture to pan the camera between 2 views.master
chrisgregan
10 years ago
5 changed files with 88 additions and 1 deletions
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 893af7b9a2a87449e9bb197699aa46b5 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 3e862766e64934bd1987a5ce891d04fb |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
Loading…
Reference in new issue