bool CheckInteractionType(InteractableComponent.INTERACTION_TYPE _interactionType) { if (_interactionType == InteractableComponent.INTERACTION_TYPE.ON_CLICK) { TouchTracker tm = TouchInputManager.GetInstance().m_TouchTracker[0]; if (tm.GetTouchBegan()) { return(true); } } else if (_interactionType == InteractableComponent.INTERACTION_TYPE.ON_LONG_PRESS) { TouchTracker tm = TouchInputManager.GetInstance().m_TouchTracker[0]; if (tm.m_TouchDidBegin && !tm.m_TouchDidMove && tm.GetTimeSinceTouchBegan() > 0.5f) { return(true); } } else if (_interactionType == InteractableComponent.INTERACTION_TYPE.ON_CLICK_UP) { TouchTracker tm = TouchInputManager.GetInstance().m_TouchTracker[0]; if (tm.GetTouchEnded()) { return(true); } } return(false); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } display = displayText.GetComponent <TextMeshProUGUI>(); touchCursors = new TouchCursor[fingersSupported]; tapListeners = new List <ITapListener> [fingersSupported]; swipeListeners = new List <ISwipeListener> [fingersSupported]; dragListeners = new List <IDragListener> [fingersSupported]; touchDeltaPoisitons = new List <Vector2> [fingersSupported]; touchStartEndPoints = new Vector3[fingersSupported][]; touchTimes = new Vector2[fingersSupported]; inputTypes = new TouchInputType[fingersSupported]; for (int i = 0; i < fingersSupported; i++) { touchDeltaPoisitons[i] = new List <Vector2>(); touchStartEndPoints[i] = new Vector3[2]; tapListeners[i] = new List <ITapListener>(); swipeListeners[i] = new List <ISwipeListener>(); dragListeners[i] = new List <IDragListener>(); inputTypes[i] = TouchInputType.TAP; } }
public static TouchInputManager Instance() { if (touchInstance == null) { touchInstance = new TouchInputManager(); } return(touchInstance); }
private readonly int objectLayer = 10; // object layer number public void Start() { this.circleCol = this.GetComponentInChildren <CircleCollider2D>(); Physics2D.IgnoreLayerCollision(this.circleCol.gameObject.layer, objectLayer); this.rb = GameObject.FindGameObjectWithTag("Core").GetComponent <Rigidbody2D>(); this.input = GameObject.FindGameObjectWithTag("Canvas").GetComponent <TouchInputManager>(); this.input.isJoystickActive = this.isJoystickActive; }
// Start is called before the first frame update void Start() { text = this.gameObject.GetComponent <TextMeshProUGUI>(); TouchInputManager touchInputManager = TouchInputManager.getInstance(); touchInputManager.SubscribeSwipeListener(this, 0); touchInputManager.SubscribeTapListener(this, 0); touchInputManager.SubscribeDragListener(this, 0); }
private void Start() { SetScore(); #if UNITY_ANDROID || UNITY_IOS touchControls = GetComponent <TouchInputManager>(); #endif StartCoroutine(GameLoop()); }
private void Awake() { if (touchInstance != null && touchInstance != this) { Destroy(this.gameObject); } else { touchInstance = this; } }
public override bool GetButtonUp(int playerId, InputAction action) { bool value = Input.GetButtonUp(actions[playerId][(int)action]); if (UseTouchInput) { value |= TouchInputManager.GetButtonUp(playerId, action); } return(value); }
private void Start() { cameraController = GetComponent <MapSceneCameraController>(); inputManager = GetComponent <TouchInputManager>(); inputManager.touchStart += TouchStart; inputManager.touchMove += TouchMove; inputManager.touchEnd += TouchEnd; mapUnitMask = LayerMask.GetMask("Unit"); }
void Start() { gameManager = this.GetComponent <GameManager>(); //Assigns the GameManger script component to gameManager mainCharacterAnimator = this.GetComponent <Animator>(); //Assigns the Animator component to mainCharacterAnimator inputManager = this.GetComponent <TouchInputManager>(); //Assigns the TouchInputManager script component to InputManager rb = GetComponent <Rigidbody>(); //Assigns the Rigidbody component to InputManager playerData = this.GetComponent <PlayerData>(); //Assigns the PlayerData component to playerData uiManager = this.GetComponent <UIManager>(); //Assigns the UIManager component to uiManager uiHeartsCounter = uiManager.uiHeartsarr.Length; //get the numbers of hearts in array from UImanager activeObstacles = true; //player will recive damage from obstacles SittingOnTrainStation(); //calls the function, runs the menu screen on start }
public TouchInputManager() { SetupPlatform(); if (instance != this) { instance = this; } //Sets default as iPhone control wrapper playerControl = new IphoneTouchWrapper(); Debug.Log("Touch Input Manager Instantiated"); }
// Start is called before the first frame update void Start() { touchInputManager = TouchInputManager.getInstance(); if (touchInputManager == null) { Debug.LogError("Touch Movable Error: There is no TouchInputManager!"); Destroy(this.gameObject); } else { rigidBody = this.gameObject.GetComponent <Rigidbody2D>(); //touchInputManager.subscribeTouchMovement(this, touchToFollow); } }
public override float GetAxis(int playerId, InputAction action) { float value = Input.GetAxisRaw(actions[playerId][(int)action]); if (UseTouchInput) { float touchValue = TouchInputManager.GetAxis(playerId, action); if (Mathf.Abs(touchValue) > Mathf.Abs(value)) { value = touchValue; } } return(value); }
public static void InitializeGameSystems() { touchInput = new TouchInputManager(); controlInput = new ControllerInputManager(); game = new Game(); Lib.current.addChild(game); Lib.current.get_stage().dispatchEvent(new Event(Event.RESIZE)); game.init(); game.render.set_zoom(1.15); Lib.current.addChild(game.gui); Lib.current.get_stage().renderer.validateTransform(); Lib.current.renderer.validateTransform(); Lib.current.get_stage().dispatchEvent(new Event(Event.RESIZE)); }
private void Start() { if (playerAvatar == null) { Debug.LogError("Player Avatar is null!"); Destroy(this.gameObject); } else { playerTouchMovable = playerAvatar.GetComponent <TouchMovable>(); if (playerTouchMovable == null) { Debug.LogError("Player Avatar has no touch movable!"); Destroy(this.gameObject); } TouchInputManager.getInstance().SubscribeTapListener(this, 0); dayCountdown.text = "Days until performance: " + (daysTillPerformance - (daysSoFar % daysTillPerformance)); pm = playerAvatar.GetComponent <PlayerManager>(); dr = FindObjectOfType <DialogueRunner>(); } }
void Start() { followedBy = null; isFollowed = false; nearbyInteractables = new Collider2D[0]; touchInputManager = TouchInputManager.getInstance(); if (touchInputManager == null) { Debug.LogError("Touch Movable Error: There is no TouchInputManager!"); Destroy(this.gameObject); } else if (tapCollider == null || (tapColliderRB = tapCollider.GetComponent <BoxCollider2D>()) == null) { Debug.LogError("Touch Movable Error: There is no Tap Box Collider!"); Destroy(this.gameObject); } else { da_Rigidbody = this.gameObject.GetComponent <Rigidbody2D>(); ToggleMovement(true); } }
void Start() { donnaManager.gameObject.SetActive(duoTrapeze); if (gradedPerformance) { timerText.gameObject.SetActive(true); exitBtn.SetActive(false); } duoTrapeze = false; TouchInputManager t = TouchInputManager.getInstance(); if (t == null) { Destroy(this); } trickGUI = TrickGUI.GetInstance(); t.SubscribeTapListener(this, 0); t.SubscribeSwipeListener(this, 0); if (playerAvatar == null) { Debug.Log("Player Avatar is null"); Destroy(this); } pmt = playerAvatar.GetComponent <PlayerManager_Trapeze>(); if (pmt == null) { Debug.Log("Player Avatar is missing PlayerManager_Trapeze script"); Destroy(this); } if (scriptToLoad != null) { dialogueRunner.Add(scriptToLoad); } if (canTutorial) { tutorialManager.SetActive(true); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } if (Application.isMobilePlatform) { useMouse = false; } if (!useMouse) { Input.simulateMouseWithTouches = false; } inputs = new Dictionary <int, TouchInput>(); }
private void OnTriggerExit(Collider other) { myButton.OnPointerExit(null); TouchInputManager.DeregisterListener(this); }
public void OnEnable() { activeInstances.Add( this ); // Mouse input will be handled by a MouseInputManager instance to // consolidate the complexity of mouse operations mouseHandler = new MouseInputManager(); if( useTouch ) { // Multi-touch input will be handled by a TouchInputHandler instance // to localize code complexity touchHandler = new TouchInputManager( this ); } // If an input adapter has not already been assigned, look for // a replacement or assign the default if( this.adapter == null ) { // Look for a replacement IInputAdapter component var inputAdapter = GetComponents( typeof( MonoBehaviour ) ) .Where( c => c != null && c.GetType() != null && typeof( IInputAdapter ).IsAssignableFrom( c.GetType() ) ) .FirstOrDefault(); // Use the replacement if found, otherwise use the default adapter this.adapter = (IInputAdapter)inputAdapter ?? new DefaultInput(); } Input.simulateMouseWithTouches = !this.useTouch; }
public void OnEnable() { manager = (TouchInputManager)target; }
void Awake() { Instance = this; //获取到组主控脚本 gm = GameObject.FindObjectOfType <GameManager>(); }
private void Start() { manager = this; }
void Awake() { instance = this; }
private void OnDestroy() { TouchInputManager.DeregisterListener(this); }
private void OnDisable() { TouchInputManager.DeregisterListener(this); }