Hi,
I am trying to implement EasyTouch touch screen gestures and “Camera Transitions” into our 2D game. This is actually a re-release of an older game, and while the game is 2D, it has 3D graphics, and has no player character (played as first person perspective). Point and click adventure, basically, but we would like to add gestures for mobile devices. So what I would like to happen is that when someone swipes the screen, it will change to another camera. I don’t see a way for that to happen so far. Here is the script I am trying to use:
public Camera camorig;
public Camera camleft;
public Camera camright;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void On_Swipe (Gesture gesture) {
CameraTransition cameraTransition = GameObject.FindObjectOfType<CameraTransition>();
if (cameraTransition == null) {
Debug.LogWarning (@"CameraTransition not found.");
}
else {
if (gesture.swipe == EasyTouch.SwipeDirection.Left) {
cameraTransition.DoTransition (CameraTransitionEffects.Fold, camorig, camleft, 1.0f);
} else if (gesture.swipe == EasyTouch.SwipeDirection.Right) {
cameraTransition.DoTransition (CameraTransitionEffects.Fold, camorig, camright, 1.0f);
} else {
Debug.LogWarning (@"Swipe not completed.");
}
}
}
So I don’t know if I am going about this the correct way or not. I have tried attaching the script to the camera, and to the hotspot, to no avail. I have also tried attaching script to “Quick Swipe” component, to both camera and hotspot, but that doesn’t allow me to define the camera variable in my script. I know most people attach the component and/or script to a game object, but this game is quite different, and we aren’t using game objects at all. I’m not sure how I would attach a game object to a camera so that it would know which camera I am on, so it would know to which camera to transition. I am very new to C#, so anything that you think is helpful would be much appreciated.