public void FixedUpdate() { if (characterRigidBody.velocity.y < 0) { characterRigidBody.velocity += Vector2.up * Physics2D.gravity * gravityMultiplyer * Time.deltaTime; } if (JumpAxes > Mathf.Epsilon) { NextStateAction.Invoke(CharacterState.Jump); } if (IsGrounded) { AudioManager.Instance.PlaySound(characterSounds.GroundedSound); if (Mathf.Abs(HorizontalAxes) > Mathf.Epsilon) { NextStateAction.Invoke(CharacterState.Move); } else { NextStateAction.Invoke(CharacterState.Idle); } } if (Mathf.Abs(HorizontalAxes) > 0) { characterRigidBody.velocity = new Vector2(HorizontalAxes * GameInfo.Instance.CharData.Speed, characterRigidBody.velocity.y); } SpriteFlipper.FlipSprite(characterRigidBody, characterSpriteRenderer); }
private void FixedUpdate() { var _velocity_Y = characterRigidBody.velocity.y; if (_velocity_Y < 0) { characterAnimator.SetInteger(INT_STATE, (int)CharacterState.Fall); } if (IsGrounded) { AudioManager.Instance.PlaySound(characterSounds.GroundedSound); if (Mathf.Abs(HorizontalAxes) > Mathf.Epsilon) { NextStateAction.Invoke(CharacterState.Move); } else { NextStateAction.Invoke(CharacterState.Idle); } } if (Mathf.Abs(HorizontalAxes) > 0) { characterRigidBody.velocity = new Vector2(HorizontalAxes * GameInfo.Instance.CharData.Speed, characterRigidBody.velocity.y); } SpriteFlipper.FlipSprite(characterRigidBody, characterSpriteRenderer); }
private void FixedUpdate() { if (characterRigidBody.velocity.y < 0) { NextStateAction(CharacterState.Fall); } if (JumpAxes > Mathf.Epsilon) { NextStateAction(CharacterState.Jump); } if (Mathf.Abs(HorizontalAxes) > 0) { characterRigidBody.velocity = new Vector2(HorizontalAxes * GameInfo.Instance.CharData.Speed, characterRigidBody.velocity.y); } SpriteFlipper.FlipSprite(characterRigidBody, characterSpriteRenderer); }
private void FixedUpdate() { if (IsGrounded) { if (Mathf.Abs(HorizontalAxes) > 0) { characterRigidBody.velocity = new Vector2(HorizontalAxes * GameInfo.Instance.CharData.Speed, characterRigidBody.velocity.y); if (DashAxes > Mathf.Epsilon) { if (GameInfo.Instance.CharData.HasDash) { if (GameInfo.Instance.CharData.HasReloadedDash) { NextStateAction(CharacterState.Dash); PlayerUsedDash.Invoke(); } } } if (JumpAxes > Mathf.Epsilon) { NextStateAction.Invoke(CharacterState.Jump); } } else { NextStateAction.Invoke(CharacterState.Idle); } SpriteFlipper.FlipSprite(characterRigidBody, characterSpriteRenderer); } else { NextStateAction.Invoke(CharacterState.Fall); } }