//------------------ Służy do obliczeń itp odnośnie controlera postaci------------------ void Movement() { if (isCrouch == true) { movement = 0; jumpVelocity = 0; } else { jumpVelocity = 2.9f; } //joystick !!!!!! if (joystick.Horizontal >= .2f) { movement = speed; } else if (joystick.Horizontal <= -.2f) { movement = -speed; } else { movement = 0; } if (movement > 0) { SR.flipX = false; } else if (movement < 0) { SR.flipX = true; } //skok if (Input.GetKeyDown(KeyCode.Space)) { if (rB2D.velocity.y == 0) { rB2D.AddForce(transform.up * jumpVelocity, ForceMode2D.Impulse); } } //kucanie if (isCrouchPressed == true || Input.GetKey(KeyCode.S)) { if (isManaEmpty == true) { speed = 1.3f; isCrouch = false; shieldControll.Disable(); return; } if (isAir == true) { return; } manabar.ShieldWhenS(); speed = 0; isCrouch = true; shieldControll.Enable(); if (manabar.mana.manaAmount <= 2) { isManaEmpty = true; } return; } else { if (manabar.mana.manaAmount >= 2) { isManaEmpty = false; } speed = 1.3f; isCrouch = false; shieldControll.Disable(); } this.transform.position += new Vector3(movement * Time.deltaTime, 0, 0); }