// Update is called once per frame void Update() { if (GetComponent <PlayerHealth>().GetPlayerHealthForGUI() > 0) { if (Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.RightArrow)) { IsMoving = false; } ///Left and Right Movement if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow)) { transform.position += Vector3.right * movementSpeed * Time.deltaTime; currentRotation = playerRotation.Right; IsRotationChanged = true; IsMoving = true; } if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) { transform.position += Vector3.left * movementSpeed * Time.deltaTime; currentRotation = playerRotation.Left; IsRotationChanged = true; IsMoving = true; } //Jump if ((Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)) && maxJumpCount >= JumpCount) { JumpCount++; animator.SetBool("IsJumping", true); IsMoving = false; HandleJumpAmount(); //Activate Particle } //Crouch if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.LeftControl)) { } //Transition if (Input.GetKeyDown(KeyCode.E)) { IsTransitionLine = true; } if (IsRotationChanged) { HandleRotation(); } animator.SetBool("IsMoving", IsMoving); } }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D> (); currentRotation = playerRotation.Right; IsRotationChanged = false; animator = GetComponent <Animator> (); IsTransitionLine = false; }