void Update() { if (!moveFunction.canMove) { return; } x = Input.GetAxis("Horizontal"); y = Input.GetAxis("Vertical"); xRaw = Input.GetAxisRaw("Horizontal"); yRaw = Input.GetAxisRaw("Vertical"); Vector2 dir = new Vector2(x, y); if (isFreeControl) { moveFunction.Walk(dir); if (Input.GetButtonDown("Jump")) { moveFunction.Jump(Vector2.up); } if (Input.GetButton("Fire3")) { moveFunction.GrabWall(); } if (Input.GetKeyDown(KeyCode.LeftControl)) { if (xRaw != 0 || yRaw != 0) { moveFunction.Dash(new Vector2(xRaw, yRaw)); } } } else { inputJump = false; inputGrab = false; inputDash = false; if (xRaw < -changePoint) { inputLeft = true; inputRight = false; } if (xRaw == 0) { inputLeft = false; inputRight = false; } if (xRaw > changePoint) { inputLeft = false; inputRight = true; } if (yRaw > changePoint) { inputUp = true; inputDown = false; } if (yRaw == 0) { inputUp = false; inputDown = false; } if (yRaw < -changePoint) { inputUp = false; inputDown = true; } if (Input.GetButton("Jump")) { downJump = false; inputJump = true; btnJump = true; } if (Input.GetButtonDown("Jump")) { inputJump = true; downJump = true; } if (Input.GetButtonUp("Jump")) { inputJump = false; btnJump = false; } if (Input.GetButton("Fire3")) { inputGrab = true; } if (Input.GetKey(KeyCode.LeftControl)) { inputDash = true; btnDash = true; downDash = false; } if (Input.GetKeyDown(KeyCode.LeftControl)) { inputDash = true; downDash = true; } if (Input.GetKeyUp(KeyCode.LeftControl)) { inputDash = false; btnDash = false; } if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow)) { StartCoroutine(_setDownFalse()); } if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow)) { downBtn = true; } if (Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.DownArrow) || Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) { StopCoroutine(_setDownFalse()); downBtn = false; } IEnumerator _setDownFalse() { yield return(new WaitForSeconds(.2f)); downBtn = false; } playerbools = new bool[7] { inputLeft, inputRight, inputUp, inputDown, inputJump, inputDash, inputGrab, }; CheckMergeInput(); moveFunction.ReSide(x); moveFunction.SetCommonThing(); x = 0; xRaw = 0; y = 0; yRaw = 0; if (inputLeft && playerboolFuncs[0]) { x = -1; xRaw = -1; } if (inputRight && playerboolFuncs[1]) { x = 1; xRaw = 1; } if (inputUp && playerboolFuncs[2]) { y = 1; yRaw = 1; } if (inputDown && playerboolFuncs[3]) { y = -1; yRaw = -1; } if (inputLeft == inputRight && inputRight == true) { x = 0; xRaw = 0; } if (inputDown == inputUp && inputUp == true) { x = 0; xRaw = 0; } dir = new Vector2(x, y); moveFunction.Walk(dir); if (inputJump && downJump) { moveFunction.Jump(Vector2.up); } if (inputGrab) { moveFunction.GrabWall(); } if (inputDash && downDash) { if (xRaw != 0 || yRaw != 0) { moveFunction.Dash(new Vector2(xRaw, yRaw)); } } } moveFunction.SetCollision(x, y); }