From 683988fc9712fff6b3e1b607ceaadb87997628e7 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Wed, 11 Jun 2025 14:20:35 -0700 Subject: [PATCH] Remove dum shit --- Assets/Scripts/GamePlayer.cs | 75 +++++++++++------------------------- 1 file changed, 22 insertions(+), 53 deletions(-) diff --git a/Assets/Scripts/GamePlayer.cs b/Assets/Scripts/GamePlayer.cs index 077fb3f..a45d5b4 100644 --- a/Assets/Scripts/GamePlayer.cs +++ b/Assets/Scripts/GamePlayer.cs @@ -182,7 +182,7 @@ public class GamePlayer : MonoBehaviour { doMoveRight = true; } - if (controllerJump || Keyboard.current.spaceKey.isPressed || Keyboard.current.upArrowKey.isPressed || Keyboard.current.wKey.isPressed || Keyboard.current.downArrowKey.isPressed || Keyboard.current.sKey.isPressed || Keyboard.current.kKey.isPressed || Keyboard.current.iKey.isPressed || Mouse.current.leftButton.isPressed && !Application.isMobilePlatform || (Gamepad.current != null && Gamepad.current.buttonSouth.isPressed)) + if (controllerJump || Keyboard.current.spaceKey.isPressed || Keyboard.current.upArrowKey.isPressed || Keyboard.current.wKey.isPressed || Keyboard.current.downArrowKey.isPressed || Keyboard.current.sKey.isPressed || Keyboard.current.kKey.isPressed || Keyboard.current.iKey.isPressed || Mouse.current.leftButton.isPressed || (Gamepad.current != null && Gamepad.current.buttonSouth.isPressed)) { doJump = true; } @@ -193,62 +193,31 @@ public class GamePlayer : MonoBehaviour } if (Application.isMobilePlatform) { - if (!Application.isMobilePlatform) + var touches = UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches; + for (int i = 0; i < touches.Count; i++) { - if (Mouse.current.leftButton.isPressed) + var pos = touches[i].screenPosition; + UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(new UnityEngine.Vector3(pos.x, pos.y, 0f)); + clickPosition.z = 0f; + if (leftArrow.GetComponent().bounds.Contains(clickPosition)) { - UnityEngine.Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Pointer.current.position.ReadValue()); - touchPosition.z = 0f; - if (leftArrow.GetComponent().bounds.Contains(touchPosition)) - { - doMoveLeft = true; - } - if (rightArrow.GetComponent().bounds.Contains(touchPosition)) - { - doMoveRight = true; - } - if (jumpArrow.GetComponent().bounds.Contains(touchPosition)) - { - doJump = true; - } - if (restartButton.GetComponent().bounds.Contains(touchPosition)) - { - doRestart = true; - } - if (backButton.GetComponent().bounds.Contains(touchPosition)) - { - doBack = true; - } + doMoveLeft = true; } - } - else - { - var touches = UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches; - for (int i = 0; i < touches.Count; i++) + if (rightArrow.GetComponent().bounds.Contains(clickPosition)) { - var pos = touches[i].screenPosition; - UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(new UnityEngine.Vector3(pos.x, pos.y, 0f)); - clickPosition.z = 0f; - if (leftArrow.GetComponent().bounds.Contains(clickPosition)) - { - doMoveLeft = true; - } - if (rightArrow.GetComponent().bounds.Contains(clickPosition)) - { - doMoveRight = true; - } - if (jumpArrow.GetComponent().bounds.Contains(clickPosition)) - { - doJump = true; - } - if (restartButton.GetComponent().bounds.Contains(clickPosition)) - { - doRestart = true; - } - if (backButton.GetComponent().bounds.Contains(clickPosition)) - { - doBack = true; - } + doMoveRight = true; + } + if (jumpArrow.GetComponent().bounds.Contains(clickPosition)) + { + doJump = true; + } + if (restartButton.GetComponent().bounds.Contains(clickPosition)) + { + doRestart = true; + } + if (backButton.GetComponent().bounds.Contains(clickPosition)) + { + doBack = true; } } }