private void HandleInput() { if (GameSingleton.instance.GameBegins) { //For PC Version // input = new Vector2(Input.GetAxis("Horizontal"),Input.GetAxis("Vertical")); // 8-directional movement #region Desktop Input // // if (Input.GetKeyDown(KeyCode.Mouse0)) // { // swipeStartPos = Input.mousePosition; // // } // // if (Input.GetKeyUp(KeyCode.Mouse0)) // { // float swipeDistance = Mathf.Abs(swipeStartPos.x - Input.mousePosition.x); // // if (swipeDistance >= swipeThreshold && IsMove == false) // { // bool swipeLeft = swipeStartPos.x - Input.mousePosition.x > 0; // // if (swipeLeft) // { // if (currentSpotIndex > 0) // { // StartCoroutine(MoveToDestinationPoint(swipeLeft)); // } // } // else // { // if (currentSpotIndex < spots.Count - 1) // { // StartCoroutine(MoveToDestinationPoint(swipeLeft)); // } // } // } // else // { // if (weaponEnabled == false) // { // ActivateWeaponAnimation(); // _inventory.ActivateWeapon(); // GameSingleton.instance._soundEffectHandler.SpawnSoundEffect(SoundType.Splat); // } // } // } #endregion #region Android Input //For Android Version if (Input.touchCount > 0) { if (Input.GetTouch(0).phase.Equals(TouchPhase.Began)) { swipeStartPos = Input.mousePosition; } if (Input.GetTouch(0).phase.Equals(TouchPhase.Ended)) { float swipeDistance = Mathf.Abs(swipeStartPos.x - Input.mousePosition.x); if (swipeDistance >= swipeThreshold && IsMove == false) { bool swipeLeft = swipeStartPos.x - Input.mousePosition.x > 0; if (swipeLeft) { if (currentSpotIndex > 0) { StartCoroutine(MoveToDestinationPoint(swipeLeft)); } } else { if (currentSpotIndex < spots.Count - 1) { StartCoroutine(MoveToDestinationPoint(swipeLeft)); } } } else { if (weaponEnabled == false) { ActivateWeaponAnimation(); _inventory.ActivateWeapon(); GameSingleton.instance._soundEffectHandler.SpawnSoundEffect(SoundType.Splat); } } } } #endregion } else { swipeStartPos = Input.mousePosition; } }