├── .gitignore ├── .editorconfig ├── UNLICENSE.meta ├── README.md.meta ├── Runtime ├── Input │ ├── ScreenPanRecognizer.cs │ ├── ScreenTapRecognizer.cs │ ├── ScreenPinchRecognizer.cs │ ├── ScreenSwipeRecognizer.cs │ ├── ScreenTwistRecognizer.cs │ ├── ScreenPanRecognizer.cs.meta │ ├── ScreenPinchRecognizer.cs.meta │ ├── ScreenSwipeRecognizer.cs.meta │ ├── ScreenTapRecognizer.cs.meta │ ├── ScreenTwistRecognizer.cs.meta │ ├── AInputGestureRecognizer.cs.meta │ ├── ScreenEdgePanRecognizer.cs.meta │ ├── ScreenLongPressRecognizer.cs.meta │ ├── ScreenLongPressRecognizer.cs │ ├── ScreenEdgePanRecognizer.cs │ └── AInputGestureRecognizer.cs ├── EventSystem │ ├── PanRecognizer.cs │ ├── TapRecognizer.cs │ ├── PinchRecognizer.cs │ ├── SwipeRecognizer.cs │ ├── TwistRecognizer.cs │ ├── PanRecognizer.cs.meta │ ├── PinchRecognizer.cs.meta │ ├── SwipeRecognizer.cs.meta │ ├── TapRecognizer.cs.meta │ ├── TwistRecognizer.cs.meta │ ├── EdgePanRecognizer.cs.meta │ ├── LongPressRecognizer.cs.meta │ ├── AEventSystemGestureRecognizer.cs.meta │ ├── LongPressRecognizer.cs │ ├── AEventSystemGestureRecognizer.cs │ └── EdgePanRecognizer.cs ├── Common.meta ├── Input.meta ├── EventSystem.meta ├── Gestures.meta ├── Gilzoide.GestureRecognizers.asmdef.meta ├── Gestures │ ├── TapGesture.cs │ ├── LongPressGesture.cs │ ├── PinchGesture.cs │ ├── TwistGesture.cs │ ├── PanGesture.cs │ ├── EdgePanGesture.cs.meta │ ├── PanGesture.cs.meta │ ├── PinchGesture.cs.meta │ ├── SwipeGesture.cs.meta │ ├── TapGesture.cs.meta │ ├── TwistGesture.cs.meta │ ├── LongPressGesture.cs.meta │ ├── EdgePanGesture.cs │ └── SwipeGesture.cs ├── AGestureRecognizer.cs.meta ├── Common │ ├── RectEdge.cs.meta │ ├── PooledListUtils.cs.meta │ ├── SwipeDirection.cs.meta │ ├── TimeProvider.cs.meta │ ├── TouchTracker.cs.meta │ ├── TypedUnityEvents.cs.meta │ ├── RectEdge.cs │ ├── SwipeDirection.cs │ ├── PooledListUtils.cs │ ├── TypedUnityEvents.cs │ ├── TimeProvider.cs │ └── TouchTracker.cs ├── PanGestureRecognizer.cs.meta ├── PinchGestureRecognizer.cs.meta ├── SwipeGestureRecognizer.cs.meta ├── TapGestureRecognizer.cs.meta ├── TwistGestureRecognizer.cs.meta ├── EdgePanGestureRecognizer.cs.meta ├── LongPressGestureRecognizer.cs.meta ├── Gilzoide.GestureRecognizers.asmdef ├── AGestureRecognizer.cs ├── TapGestureRecognizer.cs ├── LongPressGestureRecognizer.cs ├── PanGestureRecognizer.cs ├── PinchGestureRecognizer.cs ├── TwistGestureRecognizer.cs ├── SwipeGestureRecognizer.cs └── EdgePanGestureRecognizer.cs ├── package.json.meta ├── Runtime.meta ├── Samples~ ├── Swipe+Pan │ ├── Ball.prefab.meta │ ├── Swipe+PanScene.unity.meta │ ├── Gilzoide.GestureRecognizers.Samples.SwipePan.asmdef.meta │ ├── BallPhysicsMaterial.physicsMaterial2D.meta │ ├── Ball.cs.meta │ ├── BallSpawner.cs.meta │ ├── GoalKeeper.cs.meta │ ├── BallPhysicsMaterial.physicsMaterial2D │ ├── Gilzoide.GestureRecognizers.Samples.SwipePan.asmdef │ ├── BallSpawner.cs │ ├── Ball.cs │ ├── GoalKeeper.cs │ ├── Ball.prefab │ └── Swipe+PanScene.unity └── Swipe+Pan.meta ├── package.json ├── .github └── FUNDING.yml ├── UNLICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Samples 2 | Samples.meta -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | 9 | [*.cs] 10 | indent_size = 4 -------------------------------------------------------------------------------- /UNLICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6b4a7b40774c40b69970caeb6e33abd 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97754eff7192640a189b9bde1f640037 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenPanRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenPanRecognizer : AInputGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenTapRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenTapRecognizer : AInputGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dfa46114a27b434ebe6ac30d81951cd 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/EventSystem/PanRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class PanRecognizer : AEventSystemGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/EventSystem/TapRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class TapRecognizer : AEventSystemGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenPinchRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenPinchRecognizer : AInputGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenSwipeRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenSwipeRecognizer : AInputGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenTwistRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenTwistRecognizer : AInputGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 645216b4ec07c45348de4a0d1035f561 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/EventSystem/PinchRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class PinchRecognizer : AEventSystemGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/EventSystem/SwipeRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class SwipeRecognizer : AEventSystemGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Runtime/EventSystem/TwistRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class TwistRecognizer : AEventSystemGestureRecognizer 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Ball.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7aa1983c7bd1b4c86849a8feba2f57f3 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90c95208b304243d89c912f200b1c41c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Input.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: daf109597e7504f888c9a549f7fcfda0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/EventSystem.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7186a7ea4a8b47488c56beb1e4e4f94 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Gestures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfa2ea3640a724603ba11207179f5fee 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0b82f57661c9453387ed454a646ee10 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Swipe+PanScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2876ad895b1b84c07a0402e70e819760 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Gilzoide.GestureRecognizers.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a112714c7cd74c16abf561692e52c25 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Gilzoide.GestureRecognizers.Samples.SwipePan.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f47f68b3707b4d42b3b3f475d7fa440 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/BallPhysicsMaterial.physicsMaterial2D.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e24ee4ba1e204ad78a689a45a2f6086 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 6200000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Gestures/TapGesture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Gestures 4 | { 5 | public struct TapGesture 6 | { 7 | public int NumberOfTouches; 8 | public int NumberOfTaps; 9 | public Vector2 Position; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/LongPressGesture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Gestures 4 | { 5 | public struct LongPressGesture 6 | { 7 | public int NumberOfTouches; 8 | public float PressDuration; 9 | public Vector2 Position; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/PinchGesture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers 4 | { 5 | public struct PinchGesture 6 | { 7 | public int NumberOfTouches; 8 | public Vector2 Center; 9 | public float Scale; 10 | public float Delta; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/Gestures/TwistGesture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers 4 | { 5 | public struct TwistGesture 6 | { 7 | public int NumberOfTouches; 8 | public Vector2 Center; 9 | public float Rotation; 10 | public float Delta; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/AGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bb9922df232444948f77d2fb90f73f5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/RectEdge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5386fc73a4f54830b6bf8d1820ae06d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/PanGesture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers 4 | { 5 | public struct PanGesture 6 | { 7 | public int NumberOfTouches; 8 | public Vector2 InitialPosition; 9 | public Vector2 Position; 10 | public Vector2 Delta; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Ball.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fdaf7cc45e9b41558dbfcc0d4dbdbf5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/PooledListUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea7a982b484994ef7aed4181a898c9bf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/SwipeDirection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1fb06ba90fb945b18f4af3fd7a91738 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/TimeProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbd9cf8cf336140f99fda2a905b935eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/TouchTracker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c12bf48371464a3b9c9da851791c8d9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Common/TypedUnityEvents.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b47abe5daa220477489dcfe75ba738e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/EdgePanGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1e1abf3f4be04ac4ad89a558fe5748a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/PanGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f03a9b181ad6348bcbb6e36fcb85b4b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/PinchGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8b99c7fb5a2f456ea348b77e6e20a2b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/SwipeGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed80af1cb0268410cb2cb4d301ac3686 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/TapGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f154712ecfee54e779ad3d638495fb5a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/TwistGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0bf3a4671cf41426c9add638925f204a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/PanGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7aec982c87956433e949449ed09b3da4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/PinchGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e0bc840f924647c6a832da93c682cdc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/SwipeGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5f2ef56e3c174758ba46ed7508fc484 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/TapGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18984763abeb7491085d862154cc914e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/TwistGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f1fa4c7a6d1a40619d75830d1956651 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/BallSpawner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9f2784c5579a4d44a9991fb964d4d90 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/GoalKeeper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9adb6b663d2c43be9e028d4327569db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EdgePanGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 238e0869925dc4bd79b0fcb6b5ce0f55 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/PanRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43d053513953549158c65c9b1ee744fd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/PinchRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50f3e005211b34b90aec70e4662c3003 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/SwipeRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c5355e09dab44dfda070d0ab003f550 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/TapRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e731d9168f14f4766ab159bbb70402e0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/TwistRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdf67c68f2f904b3e8b7139265a72465 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/LongPressGesture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6fda6ca9b3c9438fa0c448c3bc0bc0c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenPanRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9def5ce495844a6184d2c0093c89cf5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenPinchRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a679ce8dce7d14b42993f54a97aaea5d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenSwipeRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f36c63afaf7584e87bb19cdb164a5b57 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenTapRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f605015490ee94496b7566deb9be1954 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenTwistRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4161b7bdd6d7e4020bfc2a3a73074fce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/LongPressGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfb17c4c4793e4c998bcef1c317c266a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/EdgePanRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 970c650efd50f4862b32ac9ab241d934 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/LongPressRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92b9c09db97e541a484db6280be33ea9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/AInputGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b3306f702d18496380e5e4d134d6663 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenEdgePanRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09724f9ef9a704f0eae618e701d5824e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenLongPressRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b09ef5b25f614f919a1d66a5e470d95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/EventSystem/AEventSystemGestureRecognizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbbf9b93c7f7646358fcfe9d595950ed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenLongPressRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.Input 2 | { 3 | public class ScreenLongPressRecognizer : AInputGestureRecognizer 4 | { 5 | protected virtual void Awake() 6 | { 7 | GestureRecognizer.CoroutineRunner = this; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Runtime/EventSystem/LongPressRecognizer.cs: -------------------------------------------------------------------------------- 1 | namespace Gilzoide.GestureRecognizers.EventSystem 2 | { 3 | public class LongPressRecognizer : AEventSystemGestureRecognizer 4 | { 5 | protected virtual void Awake() 6 | { 7 | GestureRecognizer.CoroutineRunner = this; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Runtime/Common/RectEdge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Gilzoide.GestureRecognizers.Common 4 | { 5 | [Flags] 6 | public enum RectEdge 7 | { 8 | None = 0, 9 | Left = 1 << 0, 10 | Right = 1 << 1, 11 | Top = 1 << 2, 12 | Bottom = 1 << 3, 13 | Everything = Left | Right | Top | Bottom, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Runtime/Common/SwipeDirection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Gilzoide.GestureRecognizers.Common 4 | { 5 | [Flags] 6 | public enum SwipeDirection 7 | { 8 | None = 0, 9 | Left = 1 << 0, 10 | Right = 1 << 1, 11 | Up = 1 << 2, 12 | Down = 1 << 3, 13 | Everything = Left | Right | Up | Down, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/BallPhysicsMaterial.physicsMaterial2D: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!62 &6200000 4 | PhysicsMaterial2D: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: BallPhysicsMaterial 10 | friction: 0 11 | bounciness: 0.9 12 | -------------------------------------------------------------------------------- /Runtime/Gestures/EdgePanGesture.cs: -------------------------------------------------------------------------------- 1 | using Gilzoide.GestureRecognizers.Common; 2 | using UnityEngine; 3 | 4 | namespace Gilzoide.GestureRecognizers 5 | { 6 | public struct EdgePanGesture 7 | { 8 | public int NumberOfTouches; 9 | public Vector2 InitialPosition; 10 | public Vector2 Position; 11 | public Vector2 Delta; 12 | public RectEdge Edge; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Runtime/Input/ScreenEdgePanRecognizer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Input 4 | { 5 | public class ScreenEdgePanRecognizer : AInputGestureRecognizer 6 | { 7 | protected override void Update() 8 | { 9 | GestureRecognizer.Rect = new Rect(0, 0, Screen.width, Screen.height); 10 | base.Update(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Runtime/Gilzoide.GestureRecognizers.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gilzoide.GestureRecognizers", 3 | "rootNamespace": "Gilzoide.GestureRecognizers", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Runtime/Gestures/SwipeGesture.cs: -------------------------------------------------------------------------------- 1 | using Gilzoide.GestureRecognizers.Common; 2 | using UnityEngine; 3 | 4 | namespace Gilzoide.GestureRecognizers 5 | { 6 | public struct SwipeGesture 7 | { 8 | public int NumberOfTouches; 9 | public Vector2 InitialPosition; 10 | public Vector2 Vector; 11 | public float Time; 12 | public SwipeDirection SwipeDirection; 13 | 14 | public Vector2 Direction => Vector.normalized; 15 | public float Distance => Vector.magnitude; 16 | public float Velocity => Time > 0 ? Distance / Time : 0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Gilzoide.GestureRecognizers.Samples.SwipePan.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gilzoide.GestureRecognizers.Samples.SwipePan", 3 | "rootNamespace": "Gilzoide.GestureRecognizers.Samples.SwipePan", 4 | "references": [ 5 | "GUID:3a112714c7cd74c16abf561692e52c25" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": false, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.gilzoide.gesture-recognizers", 3 | "displayName": "Gesture Recognizers", 4 | "version": "1.0.0", 5 | "description": "Gesture Recognizer scripts based on Input and EventSystem handlers", 6 | "homepage": "https://github.com/gilzoide/unity-gesture-recognizers", 7 | "license": "Unlicense", 8 | "author": { 9 | "name": "Gil Barbosa Reis" 10 | }, 11 | "samples": [ 12 | { 13 | "displayName": "Swipe + Pan = Soccer", 14 | "description": "A swipe to throw ball + pan to move goalkeeper minigame", 15 | "path": "Samples~/Swipe+Pan" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/BallSpawner.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Samples.SwipePan 4 | { 5 | public class BallSpawner : MonoBehaviour 6 | { 7 | public Ball BallPrefab; 8 | public RectTransform BallParent; 9 | 10 | private Ball _ball; 11 | 12 | public void OnSwipe(SwipeGesture swipe) 13 | { 14 | if (_ball) 15 | { 16 | return; 17 | } 18 | 19 | _ball = Instantiate(BallPrefab, swipe.InitialPosition, Quaternion.identity, BallParent); 20 | _ball.Setup(swipe.Vector / swipe.Time); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Ball.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Samples.SwipePan 4 | { 5 | public class Ball : MonoBehaviour 6 | { 7 | [SerializeField] private Rigidbody2D _rigidBody; 8 | 9 | public float MaxVelocity = 2500; 10 | 11 | public void Setup(Vector2 vector) 12 | { 13 | _rigidBody.velocity = Vector2.ClampMagnitude(vector, MaxVelocity); 14 | } 15 | 16 | public void Update() 17 | { 18 | Rect screenRect = new Rect(0, 0, Screen.width, Screen.height); 19 | if (!screenRect.Contains(_rigidBody.position)) 20 | { 21 | Destroy(gameObject); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Runtime/Common/PooledListUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Gilzoide.GestureRecognizers.Common 4 | { 5 | public static class PooledListUtils 6 | { 7 | #if UNITY_2021_1_OR_NEWER 8 | public static UnityEngine.Pool.PooledObject> GetList(IEnumerable elements, out List list) 9 | { 10 | var disposable = UnityEngine.Pool.ListPool.Get(out list); 11 | list.AddRange(elements); 12 | return disposable; 13 | } 14 | #else 15 | public static System.IDisposable GetList(IEnumerable elements, out List list) 16 | { 17 | list = new List(elements); 18 | return null; 19 | } 20 | #endif 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Runtime/Common/TypedUnityEvents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Gestures; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | 6 | namespace Gilzoide.GestureRecognizers.Common 7 | { 8 | [Serializable] public class UnityEventTapGesture : UnityEvent {} 9 | [Serializable] public class UnityEventLongPressGesture : UnityEvent {} 10 | [Serializable] public class UnityEventPanGesture : UnityEvent {} 11 | [Serializable] public class UnityEventEdgePanGesture : UnityEvent {} 12 | [Serializable] public class UnityEventPinchGesture : UnityEvent {} 13 | [Serializable] public class UnityEventTwistGesture : UnityEvent {} 14 | [Serializable] public class UnityEventSwipeGesture : UnityEvent {} 15 | } 16 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [gilzoide] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: gilzoide # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: gilzoide # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/GoalKeeper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Samples.SwipePan 4 | { 5 | public class GoalKeeper : MonoBehaviour 6 | { 7 | [SerializeField] private RectTransform _goalArea; 8 | [SerializeField] private Rigidbody2D _rigidBody; 9 | 10 | private Vector2 _newPosition; 11 | 12 | void Start() 13 | { 14 | _newPosition = _rigidBody.position; 15 | } 16 | 17 | void FixedUpdate() 18 | { 19 | _rigidBody.MovePosition(_newPosition); 20 | } 21 | 22 | public void HandlePanGesture(PanGesture pan) 23 | { 24 | Vector2 position = _goalArea.InverseTransformPoint(pan.Position); 25 | Rect goalRect = _goalArea.rect; 26 | _newPosition = _goalArea.TransformPoint(Vector2.Max(goalRect.min, Vector2.Min(goalRect.max, position))); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Runtime/AGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Gilzoide.GestureRecognizers.Common; 4 | using UnityEngine; 5 | 6 | namespace Gilzoide.GestureRecognizers 7 | { 8 | [Serializable] 9 | public abstract class AGestureRecognizer 10 | { 11 | public int TouchCount => _touchTracker.Count; 12 | public ICollection TouchPositions => _touchTracker.TouchPositions; 13 | public Vector2? Centroid => _touchTracker.Centroid; 14 | public float? AverageDistanceToCentroid => _touchTracker.AverageDistanceToCentroid; 15 | 16 | protected readonly TouchTracker _touchTracker = new TouchTracker(); 17 | 18 | public virtual void TouchStarted(int touchId, Vector2 position) 19 | { 20 | _touchTracker.TouchStarted(touchId, position); 21 | } 22 | 23 | public virtual void TouchMoved(int touchId, Vector2 position) 24 | { 25 | _touchTracker.TouchMoved(touchId, position); 26 | } 27 | 28 | public virtual void TouchEnded(int touchId) 29 | { 30 | _touchTracker.TouchEnded(touchId); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Runtime/EventSystem/AEventSystemGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | 4 | namespace Gilzoide.GestureRecognizers.EventSystem 5 | { 6 | public abstract class AEventSystemGestureRecognizer : MonoBehaviour, 7 | IPointerDownHandler, IPointerUpHandler, IInitializePotentialDragHandler, IDragHandler 8 | where T : AGestureRecognizer, new() 9 | { 10 | public T GestureRecognizer = new T(); 11 | 12 | protected virtual void Start() 13 | { 14 | // No-op, but it's here so we can disable the scripts via inspector 15 | // Disabled scripts don't receive pointer events 16 | } 17 | 18 | public void OnPointerDown(PointerEventData eventData) 19 | { 20 | GestureRecognizer.TouchStarted(eventData.pointerId, eventData.position); 21 | } 22 | 23 | public void OnPointerUp(PointerEventData eventData) 24 | { 25 | GestureRecognizer.TouchEnded(eventData.pointerId); 26 | } 27 | 28 | public void OnInitializePotentialDrag(PointerEventData eventData) 29 | { 30 | eventData.useDragThreshold = false; 31 | } 32 | 33 | public void OnDrag(PointerEventData eventData) 34 | { 35 | GestureRecognizer.TouchMoved(eventData.pointerId, eventData.position); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Runtime/Common/TimeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Gilzoide.GestureRecognizers.Common 5 | { 6 | public enum TimeProvider 7 | { 8 | Time, 9 | UnscaledTime, 10 | } 11 | 12 | public static class TimeProviderExtensions 13 | { 14 | public static float GetTime(this TimeProvider timeProvider) 15 | { 16 | switch (timeProvider) 17 | { 18 | case TimeProvider.Time: 19 | return Time.time; 20 | 21 | case TimeProvider.UnscaledTime: 22 | return Time.unscaledTime; 23 | 24 | default: 25 | throw new ArgumentOutOfRangeException(nameof(timeProvider)); 26 | } 27 | } 28 | 29 | public static object WaitForSeconds(this TimeProvider timeProvider, float seconds) 30 | { 31 | switch (timeProvider) 32 | { 33 | case TimeProvider.Time: 34 | return new WaitForSeconds(seconds); 35 | 36 | case TimeProvider.UnscaledTime: 37 | return new WaitForSecondsRealtime(seconds); 38 | 39 | default: 40 | throw new ArgumentOutOfRangeException(nameof(timeProvider)); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gesture Recognizers 2 | [![openupm](https://img.shields.io/npm/v/com.gilzoide.gesture-recognizers?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.gilzoide.gesture-recognizers/) 3 | 4 | Touch/pointer gesture recognizer scripts based on [EventSystem handlers](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/SupportedEvents.html) or [Input](https://docs.unity3d.com/ScriptReference/Input.html). 5 | 6 | Implemented gestures: 7 | - Tap (configurable number of touches and taps) 8 | - Long press (configurable number of touches, press duration) 9 | - Pan (configurable number of touches) 10 | - Pinch (configurable number of touches, at least 2) 11 | - Twist (configurable number of touches, at least 2) 12 | - Swipe (configurable number of touches, supported directions, minimum distance, minimum velocity) 13 | - Edge pan (configurable number of touches, supported edges, maximum distance from edge) 14 | 15 | Gesture recognizers are implemented as pure C# classes and can be used with your own touch input data. 16 | 17 | Recognizers based on [EventSystem](Runtime/EventSystem) can be used in uGUI-based UIs, as well as physics objects if your Camera has `PhysicsRaycaster` or `Physics2DRaycaster` components. 18 | 19 | Recognizers based on [Input](Runtime/Input) detect gestures anywhere in the screen or a configurable portion of it. 20 | 21 | 22 | ## How to install 23 | This package is available on the [openupm registry](https://openupm.com/) and can be installed using the [openupm-cli](https://github.com/openupm/openupm-cli): 24 | ``` 25 | openupm add com.gilzoide.gesture-recognizers 26 | ``` 27 | 28 | Otherwise, you can install directly using the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html) with the following URL: 29 | ``` 30 | https://github.com/gilzoide/unity-gesture-recognizers.git#1.0.0 31 | ``` -------------------------------------------------------------------------------- /Runtime/TapGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Common; 3 | using Gilzoide.GestureRecognizers.Gestures; 4 | using UnityEngine; 5 | 6 | namespace Gilzoide.GestureRecognizers 7 | { 8 | [Serializable] 9 | public class TapGestureRecognizer : AGestureRecognizer 10 | { 11 | [Min(1)] public int NumberOfTouches = 1; 12 | [Min(1)] public int NumberOfTaps = 1; 13 | [Min(0)] public float MultiTapDelayWindow = 0.5f; 14 | public TimeProvider TimeProvider = TimeProvider.UnscaledTime; 15 | 16 | [Space] 17 | public UnityEventTapGesture OnTapRecognized = new UnityEventTapGesture(); 18 | 19 | protected int _tapsRecognized = 0; 20 | protected float _lastTapTime; 21 | protected Vector2 _lastTapPosition; 22 | 23 | public void Clear() 24 | { 25 | _tapsRecognized = 0; 26 | _lastTapTime = TimeProvider.GetTime(); 27 | } 28 | 29 | public override void TouchStarted(int touchId, Vector2 position) 30 | { 31 | base.TouchStarted(touchId, position); 32 | if (_tapsRecognized > 0 && TimeProvider.GetTime() > _lastTapTime + MultiTapDelayWindow) 33 | { 34 | Clear(); 35 | } 36 | 37 | if (_touchTracker.Count == NumberOfTouches) 38 | { 39 | _tapsRecognized++; 40 | _lastTapPosition = Centroid.Value; 41 | _lastTapTime = TimeProvider.GetTime(); 42 | } 43 | } 44 | 45 | public override void TouchEnded(int touchId) 46 | { 47 | base.TouchEnded(touchId); 48 | 49 | if (_tapsRecognized == NumberOfTaps && TimeProvider.GetTime() <= _lastTapTime + MultiTapDelayWindow) 50 | { 51 | OnTapRecognized.Invoke(new TapGesture 52 | { 53 | NumberOfTouches = NumberOfTouches, 54 | NumberOfTaps = NumberOfTaps, 55 | Position = _lastTapPosition, 56 | }); 57 | Clear(); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Runtime/EventSystem/EdgePanRecognizer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.EventSystem 4 | { 5 | [RequireComponent(typeof(RectTransform))] 6 | public class EdgePanRecognizer : AEventSystemGestureRecognizer 7 | { 8 | protected Canvas _canvas; 9 | protected readonly Vector3[] _worldCorners = new Vector3[4]; 10 | 11 | protected virtual void OnEnable() 12 | { 13 | _canvas = FindRootCanvas(); 14 | RefreshRect(); 15 | } 16 | 17 | protected virtual void OnTransformParentChanged() 18 | { 19 | if (isActiveAndEnabled) 20 | { 21 | _canvas = FindRootCanvas(); 22 | RefreshRect(); 23 | } 24 | } 25 | 26 | protected virtual void Update() 27 | { 28 | if (transform.hasChanged) 29 | { 30 | RefreshRect(); 31 | } 32 | } 33 | 34 | protected virtual void LateUpdate() 35 | { 36 | transform.hasChanged = false; 37 | } 38 | 39 | protected void RefreshRect() 40 | { 41 | GestureRecognizer.Rect = GetScreenRect(); 42 | } 43 | 44 | protected Rect GetScreenRect() 45 | { 46 | ((RectTransform) transform).GetWorldCorners(_worldCorners); 47 | 48 | Vector3 bottomLeft = _worldCorners[0]; 49 | Vector3 topRight = _worldCorners[2]; 50 | if (_canvas && _canvas.renderMode == RenderMode.ScreenSpaceCamera && _canvas.worldCamera != null) 51 | { 52 | Camera camera = _canvas.worldCamera; 53 | bottomLeft = camera.WorldToScreenPoint(bottomLeft); 54 | topRight = camera.WorldToScreenPoint(topRight); 55 | } 56 | return Rect.MinMaxRect(bottomLeft.x, bottomLeft.y, topRight.x, topRight.y); 57 | } 58 | 59 | protected Canvas FindRootCanvas() 60 | { 61 | Canvas canvas = GetComponentInParent(); 62 | return canvas != null ? canvas.rootCanvas : null; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Runtime/Common/TouchTracker.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Gilzoide.GestureRecognizers.Common 5 | { 6 | public class TouchTracker 7 | { 8 | protected Dictionary _touchPositions = new Dictionary(); 9 | 10 | public int Count => _touchPositions.Count; 11 | public ICollection TouchPositions => _touchPositions.Values; 12 | public Vector2? Centroid => FindCentroid(); 13 | public float? AverageDistanceToCentroid => FindAverageDistanceToCentroid(); 14 | 15 | public void TouchStarted(int touchId, Vector2 position) 16 | { 17 | _touchPositions[touchId] = position; 18 | } 19 | 20 | public void TouchMoved(int touchId, Vector2 position) 21 | { 22 | if (_touchPositions.ContainsKey(touchId)) 23 | { 24 | _touchPositions[touchId] = position; 25 | } 26 | } 27 | 28 | public void TouchEnded(int touchId) 29 | { 30 | _touchPositions.Remove(touchId); 31 | } 32 | 33 | public IEnumerable EnumerateTouchVectors() 34 | { 35 | if (Count == 0) 36 | { 37 | yield break; 38 | } 39 | 40 | Vector2 centroid = Centroid.Value; 41 | foreach (Vector2 position in TouchPositions) 42 | { 43 | yield return position - centroid; 44 | } 45 | } 46 | 47 | protected Vector2? FindCentroid() 48 | { 49 | if (Count == 0) 50 | { 51 | return null; 52 | } 53 | 54 | Vector2 centroid = Vector2.zero; 55 | foreach (Vector2 position in TouchPositions) 56 | { 57 | centroid += position; 58 | } 59 | return centroid / Count; 60 | } 61 | 62 | protected float? FindAverageDistanceToCentroid() 63 | { 64 | if (Count == 0) 65 | { 66 | return null; 67 | } 68 | 69 | Vector2 centroid = Centroid.Value; 70 | float totalDistance = 0; 71 | foreach (Vector2 position in TouchPositions) 72 | { 73 | totalDistance += Vector2.Distance(position, centroid); 74 | } 75 | return totalDistance / Count; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Runtime/LongPressGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using Gilzoide.GestureRecognizers.Common; 4 | using Gilzoide.GestureRecognizers.Gestures; 5 | using UnityEngine; 6 | 7 | namespace Gilzoide.GestureRecognizers 8 | { 9 | [Serializable] 10 | public class LongPressGestureRecognizer : AGestureRecognizer 11 | { 12 | [Min(1)] public int NumberOfTouches = 1; 13 | [Min(float.Epsilon)] public float PressDuration = 1f; 14 | public float AllowableMovement = 10; 15 | public TimeProvider TimeProvider = TimeProvider.UnscaledTime; 16 | 17 | [Space] 18 | public UnityEventLongPressGesture OnLongPressRecognized = new UnityEventLongPressGesture(); 19 | 20 | [HideInInspector] public MonoBehaviour CoroutineRunner { get; set; } 21 | 22 | protected Coroutine _pressCoroutine; 23 | protected Vector2 _initialPosition; 24 | 25 | public void Cancel() 26 | { 27 | if (_pressCoroutine != null) 28 | { 29 | CoroutineRunner.StopCoroutine(_pressCoroutine); 30 | } 31 | } 32 | 33 | public override void TouchStarted(int touchId, Vector2 position) 34 | { 35 | base.TouchStarted(touchId, position); 36 | 37 | if (TouchCount == NumberOfTouches) 38 | { 39 | _initialPosition = Centroid.Value; 40 | _pressCoroutine = CoroutineRunner.StartCoroutine(RecognizePress()); 41 | } 42 | } 43 | 44 | public override void TouchMoved(int touchId, Vector2 position) 45 | { 46 | base.TouchMoved(touchId, position); 47 | 48 | if (TouchCount >= NumberOfTouches && Vector2.Distance(_initialPosition, Centroid.Value) > AllowableMovement) 49 | { 50 | Cancel(); 51 | } 52 | } 53 | 54 | public override void TouchEnded(int touchId) 55 | { 56 | base.TouchEnded(touchId); 57 | 58 | if (TouchCount < NumberOfTouches) 59 | { 60 | Cancel(); 61 | } 62 | } 63 | 64 | protected IEnumerator RecognizePress() 65 | { 66 | yield return TimeProvider.WaitForSeconds(PressDuration); 67 | OnLongPressRecognized.Invoke(new LongPressGesture 68 | { 69 | NumberOfTouches = NumberOfTouches, 70 | PressDuration = PressDuration, 71 | Position = _initialPosition, 72 | }); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Runtime/Input/AInputGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Gilzoide.GestureRecognizers.Input 4 | { 5 | public abstract class AInputGestureRecognizer : MonoBehaviour 6 | where T : AGestureRecognizer, new() 7 | { 8 | public Rect ViewportRect = new Rect(0, 0, 1, 1); 9 | public T GestureRecognizer = new T(); 10 | 11 | protected Vector2 _lastMousePosition; 12 | 13 | protected virtual void Start() 14 | { 15 | _lastMousePosition = UnityEngine.Input.mousePosition; 16 | } 17 | 18 | protected virtual void Update() 19 | { 20 | Vector2 screenSize = new Vector2(Screen.width, Screen.height); 21 | 22 | Vector2 mousePosition = UnityEngine.Input.mousePosition; 23 | bool mouseMoved = mousePosition != _lastMousePosition; 24 | for (int i = 0; i < 3; i++) 25 | { 26 | int touchId = MouseButtonToTouchId(i); 27 | if (UnityEngine.Input.GetMouseButtonDown(i)) 28 | { 29 | if (ViewportRect.Contains(mousePosition / screenSize)) 30 | { 31 | GestureRecognizer.TouchStarted(touchId, mousePosition); 32 | } 33 | } 34 | else if (UnityEngine.Input.GetMouseButtonUp(i)) 35 | { 36 | GestureRecognizer.TouchEnded(touchId); 37 | } 38 | else if (mouseMoved && UnityEngine.Input.GetMouseButton(i)) 39 | { 40 | GestureRecognizer.TouchMoved(touchId, mousePosition); 41 | } 42 | } 43 | _lastMousePosition = mousePosition; 44 | 45 | for (int i = 0; i < UnityEngine.Input.touchCount; i++) 46 | { 47 | Touch touch = UnityEngine.Input.GetTouch(i); 48 | switch (touch.phase) 49 | { 50 | case TouchPhase.Began: 51 | if (ViewportRect.Contains(touch.position / screenSize)) 52 | { 53 | GestureRecognizer.TouchStarted(touch.fingerId, touch.position); 54 | } 55 | break; 56 | 57 | case TouchPhase.Moved: 58 | GestureRecognizer.TouchMoved(touch.fingerId, touch.position); 59 | break; 60 | 61 | case TouchPhase.Canceled: 62 | case TouchPhase.Ended: 63 | GestureRecognizer.TouchEnded(touch.fingerId); 64 | break; 65 | } 66 | } 67 | } 68 | 69 | protected int MouseButtonToTouchId(int index) 70 | { 71 | return -index - 1; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Runtime/PanGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Common; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | 6 | namespace Gilzoide.GestureRecognizers 7 | { 8 | [Serializable] 9 | public class PanGestureRecognizer : AGestureRecognizer 10 | { 11 | [Min(1)] public int NumberOfTouches = 1; 12 | 13 | [Space] 14 | public UnityEventPanGesture OnPanStarted = new UnityEventPanGesture(); 15 | public UnityEventPanGesture OnPanRecognized = new UnityEventPanGesture(); 16 | public UnityEvent OnGestureEnded = new UnityEvent(); 17 | 18 | public bool IsPanning => TouchCount >= NumberOfTouches; 19 | public Vector2 Position => IsPanning ? GetPosition() : Vector2.zero; 20 | 21 | protected bool _firstMove; 22 | protected Vector2 _initialPosition; 23 | 24 | public override void TouchStarted(int touchId, Vector2 position) 25 | { 26 | if (IsPanning) 27 | { 28 | return; 29 | } 30 | 31 | base.TouchStarted(touchId, position); 32 | if (IsPanning) 33 | { 34 | _firstMove = true; 35 | } 36 | } 37 | 38 | public override void TouchMoved(int touchId, Vector2 position) 39 | { 40 | if (!IsPanning) 41 | { 42 | base.TouchMoved(touchId, position); 43 | return; 44 | } 45 | 46 | Vector2 previousPosition = GetPosition(); 47 | 48 | if (_firstMove) 49 | { 50 | _firstMove = false; 51 | _initialPosition = previousPosition; 52 | OnPanStarted.Invoke(new PanGesture 53 | { 54 | NumberOfTouches = NumberOfTouches, 55 | InitialPosition = _initialPosition, 56 | Position = previousPosition, 57 | Delta = Vector2.zero, 58 | }); 59 | } 60 | 61 | base.TouchMoved(touchId, position); 62 | 63 | Vector2 currentPosition = GetPosition(); 64 | OnPanRecognized.Invoke(new PanGesture 65 | { 66 | NumberOfTouches = NumberOfTouches, 67 | InitialPosition = _initialPosition, 68 | Position = currentPosition, 69 | Delta = currentPosition - previousPosition, 70 | }); 71 | } 72 | 73 | public override void TouchEnded(int touchId) 74 | { 75 | bool wasPanning = IsPanning; 76 | base.TouchEnded(touchId); 77 | if (!IsPanning && wasPanning) 78 | { 79 | _firstMove = false; 80 | OnGestureEnded.Invoke(); 81 | } 82 | } 83 | 84 | protected Vector2 GetPosition() 85 | { 86 | return Centroid.Value; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Runtime/PinchGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Common; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | 6 | namespace Gilzoide.GestureRecognizers 7 | { 8 | [Serializable] 9 | public class PinchGestureRecognizer : AGestureRecognizer 10 | { 11 | [Min(2)] public int NumberOfTouches = 2; 12 | 13 | [Space] 14 | public UnityEventPinchGesture OnPinchStarted = new UnityEventPinchGesture(); 15 | public UnityEventPinchGesture OnPinchRecognized = new UnityEventPinchGesture(); 16 | public UnityEvent OnGestureEnded = new UnityEvent(); 17 | 18 | public bool IsPinching => TouchCount >= NumberOfTouches; 19 | public float Scale => IsPinching ? GetCurrentScale() : 1; 20 | 21 | protected float _initialDistanceToCentroid = 1; 22 | protected bool _firstMove; 23 | 24 | public override void TouchStarted(int touchId, Vector2 position) 25 | { 26 | if (IsPinching) 27 | { 28 | return; 29 | } 30 | 31 | base.TouchStarted(touchId, position); 32 | if (IsPinching) 33 | { 34 | _initialDistanceToCentroid = Mathf.Max(0.0001f, AverageDistanceToCentroid.Value); 35 | _firstMove = true; 36 | } 37 | } 38 | 39 | public override void TouchMoved(int touchId, Vector2 position) 40 | { 41 | if (!IsPinching) 42 | { 43 | base.TouchMoved(touchId, position); 44 | return; 45 | } 46 | 47 | Vector2 centroid = Centroid.Value; 48 | 49 | if (_firstMove) 50 | { 51 | _firstMove = false; 52 | OnPinchStarted.Invoke(new PinchGesture 53 | { 54 | NumberOfTouches = NumberOfTouches, 55 | Center = centroid, 56 | Scale = 1, 57 | Delta = 0, 58 | }); 59 | } 60 | 61 | float previousScale = GetCurrentScale(); 62 | 63 | base.TouchMoved(touchId, position); 64 | 65 | float currentScale = GetCurrentScale(); 66 | OnPinchRecognized.Invoke(new PinchGesture 67 | { 68 | NumberOfTouches = NumberOfTouches, 69 | Center = centroid, 70 | Scale = currentScale, 71 | Delta = currentScale - previousScale, 72 | }); 73 | } 74 | 75 | public override void TouchEnded(int touchId) 76 | { 77 | bool wasPinching = IsPinching; 78 | base.TouchEnded(touchId); 79 | if (!IsPinching && wasPinching) 80 | { 81 | _firstMove = false; 82 | OnGestureEnded.Invoke(); 83 | } 84 | } 85 | 86 | protected float GetCurrentScale() 87 | { 88 | return AverageDistanceToCentroid.Value / _initialDistanceToCentroid; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Runtime/TwistGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Gilzoide.GestureRecognizers.Common; 5 | using UnityEngine; 6 | using UnityEngine.Events; 7 | 8 | namespace Gilzoide.GestureRecognizers 9 | { 10 | [Serializable] 11 | public class TwistGestureRecognizer : AGestureRecognizer 12 | { 13 | [Min(2)] public int NumberOfTouches = 2; 14 | 15 | [Space] 16 | public UnityEventTwistGesture OnTwistStarted = new UnityEventTwistGesture(); 17 | public UnityEventTwistGesture OnTwistRecognized = new UnityEventTwistGesture(); 18 | public UnityEvent OnGestureEnded = new UnityEvent(); 19 | 20 | public bool IsTwisting => TouchCount >= NumberOfTouches; 21 | public float Rotation => IsTwisting ? _accumulatedRotation : 0; 22 | 23 | protected float _accumulatedRotation; 24 | protected bool _firstMove; 25 | 26 | public override void TouchStarted(int touchId, Vector2 position) 27 | { 28 | if (IsTwisting) 29 | { 30 | return; 31 | } 32 | 33 | base.TouchStarted(touchId, position); 34 | if (IsTwisting) 35 | { 36 | _accumulatedRotation = 0; 37 | _firstMove = true; 38 | } 39 | } 40 | 41 | public override void TouchMoved(int touchId, Vector2 position) 42 | { 43 | if (!IsTwisting) 44 | { 45 | base.TouchMoved(touchId, position); 46 | return; 47 | } 48 | 49 | Vector2 centroid = Centroid.Value; 50 | 51 | if (_firstMove) 52 | { 53 | _firstMove = false; 54 | OnTwistStarted.Invoke(new TwistGesture 55 | { 56 | NumberOfTouches = NumberOfTouches, 57 | Center = centroid, 58 | Rotation = 0, 59 | Delta = 0, 60 | }); 61 | } 62 | 63 | using (PooledListUtils.GetList(_touchTracker.EnumerateTouchVectors(), out List previousVectors)) 64 | { 65 | base.TouchMoved(touchId, position); 66 | 67 | IEnumerable currentVectors = _touchTracker.EnumerateTouchVectors(); 68 | float deltaRotation = previousVectors.Zip(currentVectors, Vector2.SignedAngle).Average(); 69 | _accumulatedRotation += deltaRotation; 70 | OnTwistRecognized.Invoke(new TwistGesture 71 | { 72 | NumberOfTouches = NumberOfTouches, 73 | Center = centroid, 74 | Rotation = _accumulatedRotation, 75 | Delta = deltaRotation, 76 | }); 77 | } 78 | } 79 | 80 | public override void TouchEnded(int touchId) 81 | { 82 | bool wasPinching = IsTwisting; 83 | base.TouchEnded(touchId); 84 | if (!IsTwisting && wasPinching) 85 | { 86 | _firstMove = false; 87 | OnGestureEnded.Invoke(); 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Runtime/SwipeGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Common; 3 | using UnityEngine; 4 | 5 | namespace Gilzoide.GestureRecognizers 6 | { 7 | [Serializable] 8 | public class SwipeGestureRecognizer : AGestureRecognizer 9 | { 10 | [Min(1)] public int NumberOfTouches = 1; 11 | [Min(0)] public float MinimumDistance = 1; 12 | [Min(0)] public float MinimumVelocity = 1000; 13 | public SwipeDirection SupportedDirections = SwipeDirection.Up; 14 | public TimeProvider TimeProvider = TimeProvider.UnscaledTime; 15 | 16 | [Space] 17 | public UnityEventSwipeGesture OnSwipeRecognized = new UnityEventSwipeGesture(); 18 | 19 | public bool IsSwiping => TouchCount >= NumberOfTouches; 20 | public SwipeDirection Direction { get; protected set; } = SwipeDirection.None; 21 | 22 | protected Vector2 _initialPosition; 23 | protected float _initialTime; 24 | 25 | public override void TouchStarted(int touchId, Vector2 position) 26 | { 27 | if (IsSwiping) 28 | { 29 | return; 30 | } 31 | 32 | base.TouchStarted(touchId, position); 33 | if (IsSwiping) 34 | { 35 | _initialPosition = GetPosition(); 36 | _initialTime = TimeProvider.GetTime(); 37 | } 38 | } 39 | 40 | public override void TouchMoved(int touchId, Vector2 position) 41 | { 42 | base.TouchMoved(touchId, position); 43 | if (IsSwiping) 44 | { 45 | Vector2 positionDelta = GetPosition() - _initialPosition; 46 | float timeDelta = TimeProvider.GetTime() - _initialTime; 47 | SwipeDirection direction = SupportedDirections & GetSwipeDirection(positionDelta, timeDelta); 48 | if (direction != 0) 49 | { 50 | Direction = direction; 51 | OnSwipeRecognized.Invoke(new SwipeGesture 52 | { 53 | NumberOfTouches = NumberOfTouches, 54 | InitialPosition = _initialPosition, 55 | Vector = positionDelta, 56 | Time = timeDelta, 57 | SwipeDirection = Direction, 58 | }); 59 | } 60 | } 61 | } 62 | 63 | public override void TouchEnded(int touchId) 64 | { 65 | bool wasSwiping = IsSwiping; 66 | base.TouchEnded(touchId); 67 | if (!IsSwiping && wasSwiping) 68 | { 69 | Direction = SwipeDirection.None; 70 | } 71 | } 72 | 73 | protected Vector2 GetPosition() 74 | { 75 | return Centroid.Value; 76 | } 77 | 78 | public SwipeDirection GetSwipeDirection(Vector2 positionDelta, float timeDelta) 79 | { 80 | return GetSwipeDirection(positionDelta, timeDelta, MinimumDistance, MinimumVelocity); 81 | } 82 | 83 | public static SwipeDirection GetSwipeDirection(Vector2 positionDelta, float timeDelta, float distanceThreshold, float velocityThreshold) 84 | { 85 | SwipeDirection direction = SwipeDirection.None; 86 | 87 | float diffX = Mathf.Abs(positionDelta.x); 88 | float diffY = Mathf.Abs(positionDelta.y); 89 | if (diffX >= distanceThreshold && timeDelta > 0 && (diffX / timeDelta) >= velocityThreshold) 90 | { 91 | direction |= positionDelta.x > 0 ? SwipeDirection.Right : SwipeDirection.Left; 92 | } 93 | if (diffY >= distanceThreshold && timeDelta > 0 && (diffY / timeDelta) >= velocityThreshold) 94 | { 95 | direction |= positionDelta.y > 0 ? SwipeDirection.Up : SwipeDirection.Down; 96 | } 97 | return direction; 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Ball.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &379261430442394446 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 379261430442394447} 12 | - component: {fileID: 2619930789570039019} 13 | - component: {fileID: 379261430442394435} 14 | - component: {fileID: 379261430442394434} 15 | - component: {fileID: 379261430442394433} 16 | - component: {fileID: 379261430442394432} 17 | m_Layer: 5 18 | m_Name: Ball 19 | m_TagString: Untagged 20 | m_Icon: {fileID: 0} 21 | m_NavMeshLayer: 0 22 | m_StaticEditorFlags: 0 23 | m_IsActive: 1 24 | --- !u!224 &379261430442394447 25 | RectTransform: 26 | m_ObjectHideFlags: 0 27 | m_CorrespondingSourceObject: {fileID: 0} 28 | m_PrefabInstance: {fileID: 0} 29 | m_PrefabAsset: {fileID: 0} 30 | m_GameObject: {fileID: 379261430442394446} 31 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 32 | m_LocalPosition: {x: 0, y: 0, z: 0} 33 | m_LocalScale: {x: 1, y: 1, z: 1} 34 | m_ConstrainProportionsScale: 0 35 | m_Children: [] 36 | m_Father: {fileID: 0} 37 | m_RootOrder: 0 38 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 39 | m_AnchorMin: {x: 0.5, y: 0.5} 40 | m_AnchorMax: {x: 0.5, y: 0.5} 41 | m_AnchoredPosition: {x: 0, y: 217} 42 | m_SizeDelta: {x: 68, y: 100} 43 | m_Pivot: {x: 0.5, y: 0.5} 44 | --- !u!114 &2619930789570039019 45 | MonoBehaviour: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 379261430442394446} 51 | m_Enabled: 1 52 | m_EditorHideFlags: 0 53 | m_Script: {fileID: 11500000, guid: 7fdaf7cc45e9b41558dbfcc0d4dbdbf5, type: 3} 54 | m_Name: 55 | m_EditorClassIdentifier: 56 | _rigidBody: {fileID: 379261430442394435} 57 | MaxVelocity: 2500 58 | --- !u!50 &379261430442394435 59 | Rigidbody2D: 60 | serializedVersion: 4 61 | m_ObjectHideFlags: 0 62 | m_CorrespondingSourceObject: {fileID: 0} 63 | m_PrefabInstance: {fileID: 0} 64 | m_PrefabAsset: {fileID: 0} 65 | m_GameObject: {fileID: 379261430442394446} 66 | m_BodyType: 0 67 | m_Simulated: 1 68 | m_UseFullKinematicContacts: 0 69 | m_UseAutoMass: 0 70 | m_Mass: 1 71 | m_LinearDrag: 0 72 | m_AngularDrag: 0.05 73 | m_GravityScale: 0 74 | m_Material: {fileID: 6200000, guid: 9e24ee4ba1e204ad78a689a45a2f6086, type: 2} 75 | m_Interpolate: 0 76 | m_SleepingMode: 1 77 | m_CollisionDetection: 0 78 | m_Constraints: 0 79 | --- !u!58 &379261430442394434 80 | CircleCollider2D: 81 | m_ObjectHideFlags: 0 82 | m_CorrespondingSourceObject: {fileID: 0} 83 | m_PrefabInstance: {fileID: 0} 84 | m_PrefabAsset: {fileID: 0} 85 | m_GameObject: {fileID: 379261430442394446} 86 | m_Enabled: 1 87 | m_Density: 1 88 | m_Material: {fileID: 6200000, guid: 9e24ee4ba1e204ad78a689a45a2f6086, type: 2} 89 | m_IsTrigger: 0 90 | m_UsedByEffector: 0 91 | m_UsedByComposite: 0 92 | m_Offset: {x: 0, y: 0} 93 | serializedVersion: 2 94 | m_Radius: 34 95 | --- !u!222 &379261430442394433 96 | CanvasRenderer: 97 | m_ObjectHideFlags: 0 98 | m_CorrespondingSourceObject: {fileID: 0} 99 | m_PrefabInstance: {fileID: 0} 100 | m_PrefabAsset: {fileID: 0} 101 | m_GameObject: {fileID: 379261430442394446} 102 | m_CullTransparentMesh: 1 103 | --- !u!114 &379261430442394432 104 | MonoBehaviour: 105 | m_ObjectHideFlags: 0 106 | m_CorrespondingSourceObject: {fileID: 0} 107 | m_PrefabInstance: {fileID: 0} 108 | m_PrefabAsset: {fileID: 0} 109 | m_GameObject: {fileID: 379261430442394446} 110 | m_Enabled: 1 111 | m_EditorHideFlags: 0 112 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 113 | m_Name: 114 | m_EditorClassIdentifier: 115 | m_Material: {fileID: 0} 116 | m_Color: {r: 1, g: 1, b: 1, a: 1} 117 | m_RaycastTarget: 1 118 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 119 | m_Maskable: 1 120 | m_OnCullStateChanged: 121 | m_PersistentCalls: 122 | m_Calls: [] 123 | m_FontData: 124 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 125 | m_FontSize: 88 126 | m_FontStyle: 0 127 | m_BestFit: 0 128 | m_MinSize: 1 129 | m_MaxSize: 142 130 | m_Alignment: 4 131 | m_AlignByGeometry: 0 132 | m_RichText: 1 133 | m_HorizontalOverflow: 0 134 | m_VerticalOverflow: 0 135 | m_LineSpacing: 1 136 | m_Text: O 137 | -------------------------------------------------------------------------------- /Runtime/EdgePanGestureRecognizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gilzoide.GestureRecognizers.Common; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | 6 | namespace Gilzoide.GestureRecognizers 7 | { 8 | [Serializable] 9 | public class EdgePanGestureRecognizer : AGestureRecognizer 10 | { 11 | [Min(1)] public int NumberOfTouches = 1; 12 | [Min(0.0001f)] public float EdgeThreshold = 50; 13 | public RectEdge SupportedEdges = RectEdge.Left; 14 | 15 | [Space] 16 | public UnityEventEdgePanGesture OnEdgePanStarted = new UnityEventEdgePanGesture(); 17 | public UnityEventEdgePanGesture OnEdgePanRecognized = new UnityEventEdgePanGesture(); 18 | public UnityEvent OnGestureEnded = new UnityEvent(); 19 | 20 | public Rect Rect { get; set; } 21 | 22 | public bool IsPanning => TouchCount >= NumberOfTouches; 23 | public RectEdge Edge => IsPanning ? _possibleEdges : RectEdge.None; 24 | public Vector2 Position => IsPanning ? GetPosition() : Vector2.zero; 25 | 26 | protected bool _firstMove; 27 | protected Vector2 _initialPosition; 28 | protected RectEdge _possibleEdges = RectEdge.None; 29 | 30 | public override void TouchStarted(int touchId, Vector2 position) 31 | { 32 | if (IsPanning) 33 | { 34 | return; 35 | } 36 | 37 | if (_possibleEdges == RectEdge.None) 38 | { 39 | _possibleEdges = SupportedEdges; 40 | } 41 | 42 | RectEdge pointerEdge = GetRectEdgeForPosition(position); 43 | if ((pointerEdge & _possibleEdges) == 0) 44 | { 45 | return; 46 | } 47 | 48 | _possibleEdges &= pointerEdge; 49 | base.TouchStarted(touchId, position); 50 | if (IsPanning) 51 | { 52 | _firstMove = true; 53 | } 54 | } 55 | 56 | public override void TouchMoved(int touchId, Vector2 position) 57 | { 58 | if (!IsPanning) 59 | { 60 | base.TouchMoved(touchId, position); 61 | return; 62 | } 63 | 64 | Vector2 previousPosition = GetPosition(); 65 | 66 | if (_firstMove) 67 | { 68 | _firstMove = false; 69 | _initialPosition = previousPosition; 70 | OnEdgePanStarted.Invoke(new EdgePanGesture 71 | { 72 | NumberOfTouches = NumberOfTouches, 73 | InitialPosition = _initialPosition, 74 | Position = previousPosition, 75 | Delta = Vector2.zero, 76 | Edge = _possibleEdges, 77 | }); 78 | } 79 | 80 | base.TouchMoved(touchId, position); 81 | 82 | Vector2 currentPosition = GetPosition(); 83 | OnEdgePanRecognized.Invoke(new EdgePanGesture 84 | { 85 | NumberOfTouches = NumberOfTouches, 86 | InitialPosition = _initialPosition, 87 | Position = currentPosition, 88 | Delta = currentPosition - previousPosition, 89 | Edge = _possibleEdges, 90 | }); 91 | } 92 | 93 | public override void TouchEnded(int touchId) 94 | { 95 | bool wasPanning = IsPanning; 96 | base.TouchEnded(touchId); 97 | if (!IsPanning && wasPanning) 98 | { 99 | _firstMove = false; 100 | _possibleEdges = SupportedEdges; 101 | OnGestureEnded.Invoke(); 102 | } 103 | } 104 | 105 | public RectEdge GetRectEdgeForPosition(Vector2 position) 106 | { 107 | RectEdge edge = RectEdge.None; 108 | 109 | if (position.x >= Rect.xMin && position.x <= Rect.xMin + EdgeThreshold) 110 | { 111 | edge |= RectEdge.Left; 112 | } 113 | if (position.x <= Rect.xMax && position.x >= Rect.xMax - EdgeThreshold) 114 | { 115 | edge |= RectEdge.Right; 116 | } 117 | 118 | if (position.y >= Rect.yMin && position.y <= Rect.yMin + EdgeThreshold) 119 | { 120 | edge |= RectEdge.Bottom; 121 | } 122 | if (position.y <= Rect.yMax && position.y >= Rect.yMax - EdgeThreshold) 123 | { 124 | edge |= RectEdge.Top; 125 | } 126 | 127 | return edge; 128 | } 129 | 130 | protected Vector2 GetPosition() 131 | { 132 | return Centroid.Value; 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /Samples~/Swipe+Pan/Swipe+PanScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.4439403, g: 0.4931519, b: 0.5722083, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &130928998 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 130929003} 135 | - component: {fileID: 130929002} 136 | - component: {fileID: 130929001} 137 | m_Layer: 0 138 | m_Name: BallManager 139 | m_TagString: Untagged 140 | m_Icon: {fileID: 0} 141 | m_NavMeshLayer: 0 142 | m_StaticEditorFlags: 0 143 | m_IsActive: 1 144 | --- !u!114 &130929001 145 | MonoBehaviour: 146 | m_ObjectHideFlags: 0 147 | m_CorrespondingSourceObject: {fileID: 0} 148 | m_PrefabInstance: {fileID: 0} 149 | m_PrefabAsset: {fileID: 0} 150 | m_GameObject: {fileID: 130928998} 151 | m_Enabled: 1 152 | m_EditorHideFlags: 0 153 | m_Script: {fileID: 11500000, guid: f36c63afaf7584e87bb19cdb164a5b57, type: 3} 154 | m_Name: 155 | m_EditorClassIdentifier: 156 | ViewportRect: 157 | serializedVersion: 2 158 | x: 0 159 | y: 0 160 | width: 1 161 | height: 0.5 162 | GestureRecognizer: 163 | NumberOfTouches: 1 164 | MinimumDistance: 100 165 | MinimumVelocity: 500 166 | SupportedDirections: 4 167 | TimeProvider: 1 168 | OnSwipeRecognized: 169 | m_PersistentCalls: 170 | m_Calls: 171 | - m_Target: {fileID: 130929002} 172 | m_TargetAssemblyTypeName: Gilzoide.GestureRecognizers.Samples.SwipePan.BallSpawner, 173 | Gilzoide.GestureRecognizers.Samples.SwipePan 174 | m_MethodName: OnSwipe 175 | m_Mode: 0 176 | m_Arguments: 177 | m_ObjectArgument: {fileID: 0} 178 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 179 | m_IntArgument: 0 180 | m_FloatArgument: 0 181 | m_StringArgument: 182 | m_BoolArgument: 0 183 | m_CallState: 2 184 | --- !u!114 &130929002 185 | MonoBehaviour: 186 | m_ObjectHideFlags: 0 187 | m_CorrespondingSourceObject: {fileID: 0} 188 | m_PrefabInstance: {fileID: 0} 189 | m_PrefabAsset: {fileID: 0} 190 | m_GameObject: {fileID: 130928998} 191 | m_Enabled: 1 192 | m_EditorHideFlags: 0 193 | m_Script: {fileID: 11500000, guid: e9f2784c5579a4d44a9991fb964d4d90, type: 3} 194 | m_Name: 195 | m_EditorClassIdentifier: 196 | BallPrefab: {fileID: 2619930789570039019, guid: 7aa1983c7bd1b4c86849a8feba2f57f3, type: 3} 197 | BallParent: {fileID: 329224120} 198 | --- !u!4 &130929003 199 | Transform: 200 | m_ObjectHideFlags: 0 201 | m_CorrespondingSourceObject: {fileID: 0} 202 | m_PrefabInstance: {fileID: 0} 203 | m_PrefabAsset: {fileID: 0} 204 | m_GameObject: {fileID: 130928998} 205 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 206 | m_LocalPosition: {x: 0, y: 0, z: 0} 207 | m_LocalScale: {x: 1, y: 1, z: 1} 208 | m_ConstrainProportionsScale: 0 209 | m_Children: [] 210 | m_Father: {fileID: 0} 211 | m_RootOrder: 4 212 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 213 | --- !u!1 &329224116 214 | GameObject: 215 | m_ObjectHideFlags: 0 216 | m_CorrespondingSourceObject: {fileID: 0} 217 | m_PrefabInstance: {fileID: 0} 218 | m_PrefabAsset: {fileID: 0} 219 | serializedVersion: 6 220 | m_Component: 221 | - component: {fileID: 329224120} 222 | - component: {fileID: 329224119} 223 | - component: {fileID: 329224118} 224 | - component: {fileID: 329224117} 225 | m_Layer: 5 226 | m_Name: Canvas 227 | m_TagString: Untagged 228 | m_Icon: {fileID: 0} 229 | m_NavMeshLayer: 0 230 | m_StaticEditorFlags: 0 231 | m_IsActive: 1 232 | --- !u!114 &329224117 233 | MonoBehaviour: 234 | m_ObjectHideFlags: 0 235 | m_CorrespondingSourceObject: {fileID: 0} 236 | m_PrefabInstance: {fileID: 0} 237 | m_PrefabAsset: {fileID: 0} 238 | m_GameObject: {fileID: 329224116} 239 | m_Enabled: 1 240 | m_EditorHideFlags: 0 241 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 242 | m_Name: 243 | m_EditorClassIdentifier: 244 | m_IgnoreReversedGraphics: 1 245 | m_BlockingObjects: 0 246 | m_BlockingMask: 247 | serializedVersion: 2 248 | m_Bits: 4294967295 249 | --- !u!114 &329224118 250 | MonoBehaviour: 251 | m_ObjectHideFlags: 0 252 | m_CorrespondingSourceObject: {fileID: 0} 253 | m_PrefabInstance: {fileID: 0} 254 | m_PrefabAsset: {fileID: 0} 255 | m_GameObject: {fileID: 329224116} 256 | m_Enabled: 1 257 | m_EditorHideFlags: 0 258 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 259 | m_Name: 260 | m_EditorClassIdentifier: 261 | m_UiScaleMode: 1 262 | m_ReferencePixelsPerUnit: 100 263 | m_ScaleFactor: 1 264 | m_ReferenceResolution: {x: 1080, y: 1920} 265 | m_ScreenMatchMode: 0 266 | m_MatchWidthOrHeight: 0.5 267 | m_PhysicalUnit: 3 268 | m_FallbackScreenDPI: 96 269 | m_DefaultSpriteDPI: 96 270 | m_DynamicPixelsPerUnit: 1 271 | m_PresetInfoIsWorld: 0 272 | --- !u!223 &329224119 273 | Canvas: 274 | m_ObjectHideFlags: 0 275 | m_CorrespondingSourceObject: {fileID: 0} 276 | m_PrefabInstance: {fileID: 0} 277 | m_PrefabAsset: {fileID: 0} 278 | m_GameObject: {fileID: 329224116} 279 | m_Enabled: 1 280 | serializedVersion: 3 281 | m_RenderMode: 0 282 | m_Camera: {fileID: 0} 283 | m_PlaneDistance: 100 284 | m_PixelPerfect: 0 285 | m_ReceivesEvents: 1 286 | m_OverrideSorting: 0 287 | m_OverridePixelPerfect: 0 288 | m_SortingBucketNormalizedSize: 0 289 | m_AdditionalShaderChannelsFlag: 25 290 | m_SortingLayerID: 0 291 | m_SortingOrder: 0 292 | m_TargetDisplay: 0 293 | --- !u!224 &329224120 294 | RectTransform: 295 | m_ObjectHideFlags: 0 296 | m_CorrespondingSourceObject: {fileID: 0} 297 | m_PrefabInstance: {fileID: 0} 298 | m_PrefabAsset: {fileID: 0} 299 | m_GameObject: {fileID: 329224116} 300 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 301 | m_LocalPosition: {x: 0, y: 0, z: 0} 302 | m_LocalScale: {x: 0, y: 0, z: 0} 303 | m_ConstrainProportionsScale: 0 304 | m_Children: 305 | - {fileID: 1966955901} 306 | - {fileID: 603750651} 307 | - {fileID: 2011787209} 308 | - {fileID: 1869884174} 309 | m_Father: {fileID: 0} 310 | m_RootOrder: 2 311 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 312 | m_AnchorMin: {x: 0, y: 0} 313 | m_AnchorMax: {x: 0, y: 0} 314 | m_AnchoredPosition: {x: 0, y: 0} 315 | m_SizeDelta: {x: 0, y: 0} 316 | m_Pivot: {x: 0, y: 0} 317 | --- !u!1 &603750650 318 | GameObject: 319 | m_ObjectHideFlags: 0 320 | m_CorrespondingSourceObject: {fileID: 0} 321 | m_PrefabInstance: {fileID: 0} 322 | m_PrefabAsset: {fileID: 0} 323 | serializedVersion: 6 324 | m_Component: 325 | - component: {fileID: 603750651} 326 | - component: {fileID: 603750653} 327 | - component: {fileID: 603750652} 328 | m_Layer: 5 329 | m_Name: '[Text] Pan to block' 330 | m_TagString: Untagged 331 | m_Icon: {fileID: 0} 332 | m_NavMeshLayer: 0 333 | m_StaticEditorFlags: 0 334 | m_IsActive: 1 335 | --- !u!224 &603750651 336 | RectTransform: 337 | m_ObjectHideFlags: 0 338 | m_CorrespondingSourceObject: {fileID: 0} 339 | m_PrefabInstance: {fileID: 0} 340 | m_PrefabAsset: {fileID: 0} 341 | m_GameObject: {fileID: 603750650} 342 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 343 | m_LocalPosition: {x: 0, y: 0, z: 0} 344 | m_LocalScale: {x: 1, y: 1, z: 1} 345 | m_ConstrainProportionsScale: 0 346 | m_Children: [] 347 | m_Father: {fileID: 329224120} 348 | m_RootOrder: 1 349 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 350 | m_AnchorMin: {x: 0, y: 1} 351 | m_AnchorMax: {x: 1, y: 1} 352 | m_AnchoredPosition: {x: 0, y: 0} 353 | m_SizeDelta: {x: 0, y: 100} 354 | m_Pivot: {x: 0.5, y: 1} 355 | --- !u!114 &603750652 356 | MonoBehaviour: 357 | m_ObjectHideFlags: 0 358 | m_CorrespondingSourceObject: {fileID: 0} 359 | m_PrefabInstance: {fileID: 0} 360 | m_PrefabAsset: {fileID: 0} 361 | m_GameObject: {fileID: 603750650} 362 | m_Enabled: 1 363 | m_EditorHideFlags: 0 364 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 365 | m_Name: 366 | m_EditorClassIdentifier: 367 | m_Material: {fileID: 0} 368 | m_Color: {r: 1, g: 1, b: 1, a: 1} 369 | m_RaycastTarget: 0 370 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 371 | m_Maskable: 1 372 | m_OnCullStateChanged: 373 | m_PersistentCalls: 374 | m_Calls: [] 375 | m_FontData: 376 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 377 | m_FontSize: 14 378 | m_FontStyle: 0 379 | m_BestFit: 1 380 | m_MinSize: 10 381 | m_MaxSize: 100 382 | m_Alignment: 1 383 | m_AlignByGeometry: 0 384 | m_RichText: 1 385 | m_HorizontalOverflow: 0 386 | m_VerticalOverflow: 0 387 | m_LineSpacing: 1 388 | m_Text: Pan to block 389 | --- !u!222 &603750653 390 | CanvasRenderer: 391 | m_ObjectHideFlags: 0 392 | m_CorrespondingSourceObject: {fileID: 0} 393 | m_PrefabInstance: {fileID: 0} 394 | m_PrefabAsset: {fileID: 0} 395 | m_GameObject: {fileID: 603750650} 396 | m_CullTransparentMesh: 1 397 | --- !u!1 &885616828 398 | GameObject: 399 | m_ObjectHideFlags: 0 400 | m_CorrespondingSourceObject: {fileID: 0} 401 | m_PrefabInstance: {fileID: 0} 402 | m_PrefabAsset: {fileID: 0} 403 | serializedVersion: 6 404 | m_Component: 405 | - component: {fileID: 885616831} 406 | - component: {fileID: 885616830} 407 | - component: {fileID: 885616829} 408 | m_Layer: 0 409 | m_Name: Main Camera 410 | m_TagString: MainCamera 411 | m_Icon: {fileID: 0} 412 | m_NavMeshLayer: 0 413 | m_StaticEditorFlags: 0 414 | m_IsActive: 1 415 | --- !u!81 &885616829 416 | AudioListener: 417 | m_ObjectHideFlags: 0 418 | m_CorrespondingSourceObject: {fileID: 0} 419 | m_PrefabInstance: {fileID: 0} 420 | m_PrefabAsset: {fileID: 0} 421 | m_GameObject: {fileID: 885616828} 422 | m_Enabled: 1 423 | --- !u!20 &885616830 424 | Camera: 425 | m_ObjectHideFlags: 0 426 | m_CorrespondingSourceObject: {fileID: 0} 427 | m_PrefabInstance: {fileID: 0} 428 | m_PrefabAsset: {fileID: 0} 429 | m_GameObject: {fileID: 885616828} 430 | m_Enabled: 1 431 | serializedVersion: 2 432 | m_ClearFlags: 2 433 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 434 | m_projectionMatrixMode: 1 435 | m_GateFitMode: 2 436 | m_FOVAxisMode: 0 437 | m_SensorSize: {x: 36, y: 24} 438 | m_LensShift: {x: 0, y: 0} 439 | m_FocalLength: 50 440 | m_NormalizedViewPortRect: 441 | serializedVersion: 2 442 | x: 0 443 | y: 0 444 | width: 1 445 | height: 1 446 | near clip plane: 0.3 447 | far clip plane: 1000 448 | field of view: 60 449 | orthographic: 0 450 | orthographic size: 5 451 | m_Depth: -1 452 | m_CullingMask: 453 | serializedVersion: 2 454 | m_Bits: 4294967295 455 | m_RenderingPath: -1 456 | m_TargetTexture: {fileID: 0} 457 | m_TargetDisplay: 0 458 | m_TargetEye: 3 459 | m_HDR: 1 460 | m_AllowMSAA: 1 461 | m_AllowDynamicResolution: 0 462 | m_ForceIntoRT: 0 463 | m_OcclusionCulling: 1 464 | m_StereoConvergence: 10 465 | m_StereoSeparation: 0.022 466 | --- !u!4 &885616831 467 | Transform: 468 | m_ObjectHideFlags: 0 469 | m_CorrespondingSourceObject: {fileID: 0} 470 | m_PrefabInstance: {fileID: 0} 471 | m_PrefabAsset: {fileID: 0} 472 | m_GameObject: {fileID: 885616828} 473 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 474 | m_LocalPosition: {x: 0, y: 1, z: -10} 475 | m_LocalScale: {x: 1, y: 1, z: 1} 476 | m_ConstrainProportionsScale: 0 477 | m_Children: [] 478 | m_Father: {fileID: 0} 479 | m_RootOrder: 0 480 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 481 | --- !u!1 &1324517827 482 | GameObject: 483 | m_ObjectHideFlags: 0 484 | m_CorrespondingSourceObject: {fileID: 0} 485 | m_PrefabInstance: {fileID: 0} 486 | m_PrefabAsset: {fileID: 0} 487 | serializedVersion: 6 488 | m_Component: 489 | - component: {fileID: 1324517830} 490 | - component: {fileID: 1324517829} 491 | - component: {fileID: 1324517828} 492 | m_Layer: 0 493 | m_Name: EventSystem 494 | m_TagString: Untagged 495 | m_Icon: {fileID: 0} 496 | m_NavMeshLayer: 0 497 | m_StaticEditorFlags: 0 498 | m_IsActive: 1 499 | --- !u!114 &1324517828 500 | MonoBehaviour: 501 | m_ObjectHideFlags: 0 502 | m_CorrespondingSourceObject: {fileID: 0} 503 | m_PrefabInstance: {fileID: 0} 504 | m_PrefabAsset: {fileID: 0} 505 | m_GameObject: {fileID: 1324517827} 506 | m_Enabled: 1 507 | m_EditorHideFlags: 0 508 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} 509 | m_Name: 510 | m_EditorClassIdentifier: 511 | m_SendPointerHoverToParent: 1 512 | m_HorizontalAxis: Horizontal 513 | m_VerticalAxis: Vertical 514 | m_SubmitButton: Submit 515 | m_CancelButton: Cancel 516 | m_InputActionsPerSecond: 10 517 | m_RepeatDelay: 0.5 518 | m_ForceModuleActive: 0 519 | --- !u!114 &1324517829 520 | MonoBehaviour: 521 | m_ObjectHideFlags: 0 522 | m_CorrespondingSourceObject: {fileID: 0} 523 | m_PrefabInstance: {fileID: 0} 524 | m_PrefabAsset: {fileID: 0} 525 | m_GameObject: {fileID: 1324517827} 526 | m_Enabled: 1 527 | m_EditorHideFlags: 0 528 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 529 | m_Name: 530 | m_EditorClassIdentifier: 531 | m_FirstSelected: {fileID: 0} 532 | m_sendNavigationEvents: 1 533 | m_DragThreshold: 10 534 | --- !u!4 &1324517830 535 | Transform: 536 | m_ObjectHideFlags: 0 537 | m_CorrespondingSourceObject: {fileID: 0} 538 | m_PrefabInstance: {fileID: 0} 539 | m_PrefabAsset: {fileID: 0} 540 | m_GameObject: {fileID: 1324517827} 541 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 542 | m_LocalPosition: {x: 0, y: 0, z: 0} 543 | m_LocalScale: {x: 1, y: 1, z: 1} 544 | m_ConstrainProportionsScale: 0 545 | m_Children: [] 546 | m_Father: {fileID: 0} 547 | m_RootOrder: 3 548 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 549 | --- !u!1 &1413741925 550 | GameObject: 551 | m_ObjectHideFlags: 0 552 | m_CorrespondingSourceObject: {fileID: 0} 553 | m_PrefabInstance: {fileID: 0} 554 | m_PrefabAsset: {fileID: 0} 555 | serializedVersion: 6 556 | m_Component: 557 | - component: {fileID: 1413741927} 558 | - component: {fileID: 1413741926} 559 | m_Layer: 0 560 | m_Name: Directional Light 561 | m_TagString: Untagged 562 | m_Icon: {fileID: 0} 563 | m_NavMeshLayer: 0 564 | m_StaticEditorFlags: 0 565 | m_IsActive: 1 566 | --- !u!108 &1413741926 567 | Light: 568 | m_ObjectHideFlags: 0 569 | m_CorrespondingSourceObject: {fileID: 0} 570 | m_PrefabInstance: {fileID: 0} 571 | m_PrefabAsset: {fileID: 0} 572 | m_GameObject: {fileID: 1413741925} 573 | m_Enabled: 1 574 | serializedVersion: 10 575 | m_Type: 1 576 | m_Shape: 0 577 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 578 | m_Intensity: 1 579 | m_Range: 10 580 | m_SpotAngle: 30 581 | m_InnerSpotAngle: 21.80208 582 | m_CookieSize: 10 583 | m_Shadows: 584 | m_Type: 2 585 | m_Resolution: -1 586 | m_CustomResolution: -1 587 | m_Strength: 1 588 | m_Bias: 0.05 589 | m_NormalBias: 0.4 590 | m_NearPlane: 0.2 591 | m_CullingMatrixOverride: 592 | e00: 1 593 | e01: 0 594 | e02: 0 595 | e03: 0 596 | e10: 0 597 | e11: 1 598 | e12: 0 599 | e13: 0 600 | e20: 0 601 | e21: 0 602 | e22: 1 603 | e23: 0 604 | e30: 0 605 | e31: 0 606 | e32: 0 607 | e33: 1 608 | m_UseCullingMatrixOverride: 0 609 | m_Cookie: {fileID: 0} 610 | m_DrawHalo: 0 611 | m_Flare: {fileID: 0} 612 | m_RenderMode: 0 613 | m_CullingMask: 614 | serializedVersion: 2 615 | m_Bits: 4294967295 616 | m_RenderingLayerMask: 1 617 | m_Lightmapping: 4 618 | m_LightShadowCasterMode: 0 619 | m_AreaSize: {x: 1, y: 1} 620 | m_BounceIntensity: 1 621 | m_ColorTemperature: 6570 622 | m_UseColorTemperature: 0 623 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 624 | m_UseBoundingSphereOverride: 0 625 | m_UseViewFrustumForShadowCasterCull: 1 626 | m_ShadowRadius: 0 627 | m_ShadowAngle: 0 628 | --- !u!4 &1413741927 629 | Transform: 630 | m_ObjectHideFlags: 0 631 | m_CorrespondingSourceObject: {fileID: 0} 632 | m_PrefabInstance: {fileID: 0} 633 | m_PrefabAsset: {fileID: 0} 634 | m_GameObject: {fileID: 1413741925} 635 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 636 | m_LocalPosition: {x: 0, y: 3, z: 0} 637 | m_LocalScale: {x: 1, y: 1, z: 1} 638 | m_ConstrainProportionsScale: 0 639 | m_Children: [] 640 | m_Father: {fileID: 0} 641 | m_RootOrder: 1 642 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 643 | --- !u!1 &1559120274 644 | GameObject: 645 | m_ObjectHideFlags: 0 646 | m_CorrespondingSourceObject: {fileID: 0} 647 | m_PrefabInstance: {fileID: 0} 648 | m_PrefabAsset: {fileID: 0} 649 | serializedVersion: 6 650 | m_Component: 651 | - component: {fileID: 1559120275} 652 | - component: {fileID: 1559120278} 653 | - component: {fileID: 1559120277} 654 | - component: {fileID: 1559120276} 655 | - component: {fileID: 1559120279} 656 | - component: {fileID: 1559120280} 657 | m_Layer: 5 658 | m_Name: GoalKeeper 659 | m_TagString: Untagged 660 | m_Icon: {fileID: 0} 661 | m_NavMeshLayer: 0 662 | m_StaticEditorFlags: 0 663 | m_IsActive: 1 664 | --- !u!224 &1559120275 665 | RectTransform: 666 | m_ObjectHideFlags: 0 667 | m_CorrespondingSourceObject: {fileID: 0} 668 | m_PrefabInstance: {fileID: 0} 669 | m_PrefabAsset: {fileID: 0} 670 | m_GameObject: {fileID: 1559120274} 671 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 672 | m_LocalPosition: {x: 0, y: 0, z: 0} 673 | m_LocalScale: {x: 1, y: 1, z: 1} 674 | m_ConstrainProportionsScale: 0 675 | m_Children: [] 676 | m_Father: {fileID: 1869884174} 677 | m_RootOrder: 0 678 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 679 | m_AnchorMin: {x: 0.5, y: 0.5} 680 | m_AnchorMax: {x: 0.5, y: 0.5} 681 | m_AnchoredPosition: {x: -12, y: 179} 682 | m_SizeDelta: {x: 250, y: 100} 683 | m_Pivot: {x: 0.5, y: 0.5} 684 | --- !u!114 &1559120276 685 | MonoBehaviour: 686 | m_ObjectHideFlags: 0 687 | m_CorrespondingSourceObject: {fileID: 0} 688 | m_PrefabInstance: {fileID: 0} 689 | m_PrefabAsset: {fileID: 0} 690 | m_GameObject: {fileID: 1559120274} 691 | m_Enabled: 1 692 | m_EditorHideFlags: 0 693 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 694 | m_Name: 695 | m_EditorClassIdentifier: 696 | m_Material: {fileID: 0} 697 | m_Color: {r: 1, g: 1, b: 1, a: 1} 698 | m_RaycastTarget: 1 699 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 700 | m_Maskable: 1 701 | m_OnCullStateChanged: 702 | m_PersistentCalls: 703 | m_Calls: [] 704 | m_Sprite: {fileID: 0} 705 | m_Type: 0 706 | m_PreserveAspect: 0 707 | m_FillCenter: 1 708 | m_FillMethod: 4 709 | m_FillAmount: 1 710 | m_FillClockwise: 1 711 | m_FillOrigin: 0 712 | m_UseSpriteMesh: 0 713 | m_PixelsPerUnitMultiplier: 1 714 | --- !u!222 &1559120277 715 | CanvasRenderer: 716 | m_ObjectHideFlags: 0 717 | m_CorrespondingSourceObject: {fileID: 0} 718 | m_PrefabInstance: {fileID: 0} 719 | m_PrefabAsset: {fileID: 0} 720 | m_GameObject: {fileID: 1559120274} 721 | m_CullTransparentMesh: 1 722 | --- !u!114 &1559120278 723 | MonoBehaviour: 724 | m_ObjectHideFlags: 0 725 | m_CorrespondingSourceObject: {fileID: 0} 726 | m_PrefabInstance: {fileID: 0} 727 | m_PrefabAsset: {fileID: 0} 728 | m_GameObject: {fileID: 1559120274} 729 | m_Enabled: 1 730 | m_EditorHideFlags: 0 731 | m_Script: {fileID: 11500000, guid: c9adb6b663d2c43be9e028d4327569db, type: 3} 732 | m_Name: 733 | m_EditorClassIdentifier: 734 | _goalArea: {fileID: 1869884174} 735 | _rigidBody: {fileID: 1559120280} 736 | --- !u!61 &1559120279 737 | BoxCollider2D: 738 | m_ObjectHideFlags: 0 739 | m_CorrespondingSourceObject: {fileID: 0} 740 | m_PrefabInstance: {fileID: 0} 741 | m_PrefabAsset: {fileID: 0} 742 | m_GameObject: {fileID: 1559120274} 743 | m_Enabled: 1 744 | m_Density: 1 745 | m_Material: {fileID: 0} 746 | m_IsTrigger: 0 747 | m_UsedByEffector: 0 748 | m_UsedByComposite: 0 749 | m_Offset: {x: 0, y: 0} 750 | m_SpriteTilingProperty: 751 | border: {x: 0, y: 0, z: 0, w: 0} 752 | pivot: {x: 0, y: 0} 753 | oldSize: {x: 0, y: 0} 754 | newSize: {x: 0, y: 0} 755 | adaptiveTilingThreshold: 0 756 | drawMode: 0 757 | adaptiveTiling: 0 758 | m_AutoTiling: 0 759 | serializedVersion: 2 760 | m_Size: {x: 250, y: 100} 761 | m_EdgeRadius: 0 762 | --- !u!50 &1559120280 763 | Rigidbody2D: 764 | serializedVersion: 4 765 | m_ObjectHideFlags: 0 766 | m_CorrespondingSourceObject: {fileID: 0} 767 | m_PrefabInstance: {fileID: 0} 768 | m_PrefabAsset: {fileID: 0} 769 | m_GameObject: {fileID: 1559120274} 770 | m_BodyType: 1 771 | m_Simulated: 1 772 | m_UseFullKinematicContacts: 0 773 | m_UseAutoMass: 0 774 | m_Mass: 1 775 | m_LinearDrag: 0 776 | m_AngularDrag: 0.05 777 | m_GravityScale: 1 778 | m_Material: {fileID: 0} 779 | m_Interpolate: 0 780 | m_SleepingMode: 1 781 | m_CollisionDetection: 0 782 | m_Constraints: 4 783 | --- !u!1 &1869884173 784 | GameObject: 785 | m_ObjectHideFlags: 0 786 | m_CorrespondingSourceObject: {fileID: 0} 787 | m_PrefabInstance: {fileID: 0} 788 | m_PrefabAsset: {fileID: 0} 789 | serializedVersion: 6 790 | m_Component: 791 | - component: {fileID: 1869884174} 792 | - component: {fileID: 1869884175} 793 | - component: {fileID: 1869884177} 794 | - component: {fileID: 1869884176} 795 | m_Layer: 5 796 | m_Name: GoalArea 797 | m_TagString: Untagged 798 | m_Icon: {fileID: 0} 799 | m_NavMeshLayer: 0 800 | m_StaticEditorFlags: 0 801 | m_IsActive: 1 802 | --- !u!224 &1869884174 803 | RectTransform: 804 | m_ObjectHideFlags: 0 805 | m_CorrespondingSourceObject: {fileID: 0} 806 | m_PrefabInstance: {fileID: 0} 807 | m_PrefabAsset: {fileID: 0} 808 | m_GameObject: {fileID: 1869884173} 809 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 810 | m_LocalPosition: {x: 0, y: 0, z: 0} 811 | m_LocalScale: {x: 1, y: 1, z: 1} 812 | m_ConstrainProportionsScale: 0 813 | m_Children: 814 | - {fileID: 1559120275} 815 | m_Father: {fileID: 329224120} 816 | m_RootOrder: 3 817 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 818 | m_AnchorMin: {x: 0, y: 0.5} 819 | m_AnchorMax: {x: 1, y: 1} 820 | m_AnchoredPosition: {x: 0, y: 0} 821 | m_SizeDelta: {x: -250, y: -100} 822 | m_Pivot: {x: 0.5, y: 0.5} 823 | --- !u!114 &1869884175 824 | MonoBehaviour: 825 | m_ObjectHideFlags: 0 826 | m_CorrespondingSourceObject: {fileID: 0} 827 | m_PrefabInstance: {fileID: 0} 828 | m_PrefabAsset: {fileID: 0} 829 | m_GameObject: {fileID: 1869884173} 830 | m_Enabled: 1 831 | m_EditorHideFlags: 0 832 | m_Script: {fileID: 11500000, guid: 43d053513953549158c65c9b1ee744fd, type: 3} 833 | m_Name: 834 | m_EditorClassIdentifier: 835 | GestureRecognizer: 836 | NumberOfTouches: 1 837 | OnPanStarted: 838 | m_PersistentCalls: 839 | m_Calls: [] 840 | OnPanRecognized: 841 | m_PersistentCalls: 842 | m_Calls: 843 | - m_Target: {fileID: 1559120278} 844 | m_TargetAssemblyTypeName: Gilzoide.GestureRecognizers.Samples.SwipePan.GoalKeeper, 845 | Gilzoide.GestureRecognizers.Samples.SwipePan 846 | m_MethodName: HandlePanGesture 847 | m_Mode: 0 848 | m_Arguments: 849 | m_ObjectArgument: {fileID: 0} 850 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 851 | m_IntArgument: 0 852 | m_FloatArgument: 0 853 | m_StringArgument: 854 | m_BoolArgument: 0 855 | m_CallState: 2 856 | OnGestureEnded: 857 | m_PersistentCalls: 858 | m_Calls: [] 859 | --- !u!114 &1869884176 860 | MonoBehaviour: 861 | m_ObjectHideFlags: 0 862 | m_CorrespondingSourceObject: {fileID: 0} 863 | m_PrefabInstance: {fileID: 0} 864 | m_PrefabAsset: {fileID: 0} 865 | m_GameObject: {fileID: 1869884173} 866 | m_Enabled: 1 867 | m_EditorHideFlags: 0 868 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 869 | m_Name: 870 | m_EditorClassIdentifier: 871 | m_Material: {fileID: 0} 872 | m_Color: {r: 1, g: 1, b: 1, a: 0} 873 | m_RaycastTarget: 1 874 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 875 | m_Maskable: 1 876 | m_OnCullStateChanged: 877 | m_PersistentCalls: 878 | m_Calls: [] 879 | m_Sprite: {fileID: 0} 880 | m_Type: 0 881 | m_PreserveAspect: 0 882 | m_FillCenter: 1 883 | m_FillMethod: 4 884 | m_FillAmount: 1 885 | m_FillClockwise: 1 886 | m_FillOrigin: 0 887 | m_UseSpriteMesh: 0 888 | m_PixelsPerUnitMultiplier: 1 889 | --- !u!222 &1869884177 890 | CanvasRenderer: 891 | m_ObjectHideFlags: 0 892 | m_CorrespondingSourceObject: {fileID: 0} 893 | m_PrefabInstance: {fileID: 0} 894 | m_PrefabAsset: {fileID: 0} 895 | m_GameObject: {fileID: 1869884173} 896 | m_CullTransparentMesh: 1 897 | --- !u!1 &1966955900 898 | GameObject: 899 | m_ObjectHideFlags: 0 900 | m_CorrespondingSourceObject: {fileID: 0} 901 | m_PrefabInstance: {fileID: 0} 902 | m_PrefabAsset: {fileID: 0} 903 | serializedVersion: 6 904 | m_Component: 905 | - component: {fileID: 1966955901} 906 | - component: {fileID: 1966955903} 907 | - component: {fileID: 1966955902} 908 | m_Layer: 5 909 | m_Name: '[Text] Swipe Instructions' 910 | m_TagString: Untagged 911 | m_Icon: {fileID: 0} 912 | m_NavMeshLayer: 0 913 | m_StaticEditorFlags: 0 914 | m_IsActive: 1 915 | --- !u!224 &1966955901 916 | RectTransform: 917 | m_ObjectHideFlags: 0 918 | m_CorrespondingSourceObject: {fileID: 0} 919 | m_PrefabInstance: {fileID: 0} 920 | m_PrefabAsset: {fileID: 0} 921 | m_GameObject: {fileID: 1966955900} 922 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 923 | m_LocalPosition: {x: 0, y: 0, z: 0} 924 | m_LocalScale: {x: 1, y: 1, z: 1} 925 | m_ConstrainProportionsScale: 0 926 | m_Children: [] 927 | m_Father: {fileID: 329224120} 928 | m_RootOrder: 0 929 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 930 | m_AnchorMin: {x: 0, y: 0} 931 | m_AnchorMax: {x: 1, y: 0} 932 | m_AnchoredPosition: {x: 0, y: 15} 933 | m_SizeDelta: {x: 0, y: 100} 934 | m_Pivot: {x: 0.5, y: 0} 935 | --- !u!114 &1966955902 936 | MonoBehaviour: 937 | m_ObjectHideFlags: 0 938 | m_CorrespondingSourceObject: {fileID: 0} 939 | m_PrefabInstance: {fileID: 0} 940 | m_PrefabAsset: {fileID: 0} 941 | m_GameObject: {fileID: 1966955900} 942 | m_Enabled: 1 943 | m_EditorHideFlags: 0 944 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 945 | m_Name: 946 | m_EditorClassIdentifier: 947 | m_Material: {fileID: 0} 948 | m_Color: {r: 1, g: 1, b: 1, a: 1} 949 | m_RaycastTarget: 0 950 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 951 | m_Maskable: 1 952 | m_OnCullStateChanged: 953 | m_PersistentCalls: 954 | m_Calls: [] 955 | m_FontData: 956 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 957 | m_FontSize: 72 958 | m_FontStyle: 0 959 | m_BestFit: 1 960 | m_MinSize: 1 961 | m_MaxSize: 100 962 | m_Alignment: 7 963 | m_AlignByGeometry: 0 964 | m_RichText: 1 965 | m_HorizontalOverflow: 0 966 | m_VerticalOverflow: 0 967 | m_LineSpacing: 1 968 | m_Text: Swipe up to throw the ball 969 | --- !u!222 &1966955903 970 | CanvasRenderer: 971 | m_ObjectHideFlags: 0 972 | m_CorrespondingSourceObject: {fileID: 0} 973 | m_PrefabInstance: {fileID: 0} 974 | m_PrefabAsset: {fileID: 0} 975 | m_GameObject: {fileID: 1966955900} 976 | m_CullTransparentMesh: 1 977 | --- !u!1 &2011787208 978 | GameObject: 979 | m_ObjectHideFlags: 0 980 | m_CorrespondingSourceObject: {fileID: 0} 981 | m_PrefabInstance: {fileID: 0} 982 | m_PrefabAsset: {fileID: 0} 983 | serializedVersion: 6 984 | m_Component: 985 | - component: {fileID: 2011787209} 986 | - component: {fileID: 2011787211} 987 | - component: {fileID: 2011787210} 988 | m_Layer: 5 989 | m_Name: Separator 990 | m_TagString: Untagged 991 | m_Icon: {fileID: 0} 992 | m_NavMeshLayer: 0 993 | m_StaticEditorFlags: 0 994 | m_IsActive: 1 995 | --- !u!224 &2011787209 996 | RectTransform: 997 | m_ObjectHideFlags: 0 998 | m_CorrespondingSourceObject: {fileID: 0} 999 | m_PrefabInstance: {fileID: 0} 1000 | m_PrefabAsset: {fileID: 0} 1001 | m_GameObject: {fileID: 2011787208} 1002 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1003 | m_LocalPosition: {x: 0, y: 0, z: 0} 1004 | m_LocalScale: {x: 1, y: 1, z: 1} 1005 | m_ConstrainProportionsScale: 0 1006 | m_Children: [] 1007 | m_Father: {fileID: 329224120} 1008 | m_RootOrder: 2 1009 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1010 | m_AnchorMin: {x: 0, y: 0.5} 1011 | m_AnchorMax: {x: 1, y: 0.5} 1012 | m_AnchoredPosition: {x: 0, y: 0} 1013 | m_SizeDelta: {x: 0, y: 4} 1014 | m_Pivot: {x: 0.5, y: 0.5} 1015 | --- !u!114 &2011787210 1016 | MonoBehaviour: 1017 | m_ObjectHideFlags: 0 1018 | m_CorrespondingSourceObject: {fileID: 0} 1019 | m_PrefabInstance: {fileID: 0} 1020 | m_PrefabAsset: {fileID: 0} 1021 | m_GameObject: {fileID: 2011787208} 1022 | m_Enabled: 1 1023 | m_EditorHideFlags: 0 1024 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 1025 | m_Name: 1026 | m_EditorClassIdentifier: 1027 | m_Material: {fileID: 0} 1028 | m_Color: {r: 1, g: 1, b: 1, a: 1} 1029 | m_RaycastTarget: 0 1030 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 1031 | m_Maskable: 1 1032 | m_OnCullStateChanged: 1033 | m_PersistentCalls: 1034 | m_Calls: [] 1035 | m_Sprite: {fileID: 0} 1036 | m_Type: 0 1037 | m_PreserveAspect: 0 1038 | m_FillCenter: 1 1039 | m_FillMethod: 4 1040 | m_FillAmount: 1 1041 | m_FillClockwise: 1 1042 | m_FillOrigin: 0 1043 | m_UseSpriteMesh: 0 1044 | m_PixelsPerUnitMultiplier: 1 1045 | --- !u!222 &2011787211 1046 | CanvasRenderer: 1047 | m_ObjectHideFlags: 0 1048 | m_CorrespondingSourceObject: {fileID: 0} 1049 | m_PrefabInstance: {fileID: 0} 1050 | m_PrefabAsset: {fileID: 0} 1051 | m_GameObject: {fileID: 2011787208} 1052 | m_CullTransparentMesh: 1 1053 | --------------------------------------------------------------------------------