Unity touch handling implementation which can be embedded and controlled from other (input) classes.
Inheritance: IDisposable
Exemple #1
0
        /// <inheritdoc />
        protected override void OnEnable()
        {
            Debug.LogWarning("[TouchScript] MobileInput is deprecated! Please use StandardInput instead.");

            if (DisableOnNonTouchPlatforms)
            {
                switch (Application.platform)
                {
                    case RuntimePlatform.Android:
                    case RuntimePlatform.IPhonePlayer:
                    case RuntimePlatform.MetroPlayerARM:
                    case RuntimePlatform.MetroPlayerX64:
                    case RuntimePlatform.MetroPlayerX86:
                    case RuntimePlatform.WP8Player:
                    case RuntimePlatform.BlackBerryPlayer:
                        break;
                    default:
                        // don't need mobile touch here
                        enabled = false;
                        return;
                }
            }

            touchHandler = new TouchHandler(Tags, beginTouch, moveTouch, endTouch, cancelTouch);

            base.OnEnable();
        }
Exemple #2
0
        /// <inheritdoc />
        protected override void OnDisable()
        {
            if (touchHandler != null)
            {
                touchHandler.Dispose();
                touchHandler = null;
            }

            base.OnDisable();
        }
 private void disableTouch()
 {
     if (touchHandler != null)
     {
         touchHandler.Dispose();
         touchHandler = null;
     }
 }
 private void enableTouch()
 {
     touchHandler = new TouchHandler(TouchTags, beginTouch, moveTouch, endTouch, cancelTouch);
     Debug.Log("[TouchScript] Initialized Unity touch input.");
 }