public override void LogicUpdate() { base.LogicUpdate(); XInput = SwordCharacter.InputHandler.InputX; YInput = SwordCharacter.InputHandler.InputY; GrabInput = SwordCharacter.InputHandler.GrabInput; JumpInput = SwordCharacter.InputHandler.JumpInput; if (JumpInput && SwordCharacterData.canWallJump) { SwordCharacter.WallJumpState.CheckWallJumpDirection(IsTouchingWall || IsTouchingGrabbable); SwordCharaterStateMachine.ChangeState(SwordCharacter.WallJumpState); } else if (IsGrounded && !GrabInput) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } else if (!IsTouchingWall && !IsTouchingGrabbable || XInput != SwordCharacter.FacingDirection && !GrabInput) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } else if ((IsTouchingWall || IsTouchingGrabbable) && !IsTouchingWallAbove && !IsTouchingGrabbableAbove) { SwordCharaterStateMachine.ChangeState(SwordCharacter.LedgeCLimbState); } }
public override void LogicUpdate() { base.LogicUpdate(); XInput = SwordCharacter.InputHandler.InputX; YInput = SwordCharacter.InputHandler.InputY; _jumpInput = SwordCharacter.InputHandler.JumpInput; _grabInput = SwordCharacter.InputHandler.GrabInput; _dashInput = SwordCharacter.InputHandler.DashInput; if (_jumpInput && SwordCharacter.JumpState.CanJump()) { SwordCharaterStateMachine.ChangeState(SwordCharacter.JumpState); } else if (_isGrabbable && _grabInput && YInput >= 0 && _isTouchingGrabbleAbove) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState); } else if (_dashInput && SwordCharacter.DashState.CheckIfCanDash()) { SwordCharaterStateMachine.ChangeState(SwordCharacter.DashState); } else if (!_isGrounded) { SwordCharacter.AirState.StartCoyoteTime(); SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } }
public override void LogicUpdate() { base.LogicUpdate(); CheckCoyoteTime(); _xInput = SwordCharacter.InputHandler.InputX; _jumpInput = SwordCharacter.InputHandler.JumpInput; _jumpInputStop = SwordCharacter.InputHandler.JumpInputStop; _grabInput = SwordCharacter.InputHandler.GrabInput; _dashInput = SwordCharacter.InputHandler.DashInput; CheckJumpMultiplier(); if (_isGrounded && SwordCharacter.CurrentVelocity.y < 0.01f) { SwordCharaterStateMachine.ChangeState(SwordCharacter.LandState); } else if ((_isTouchingWall || _isTouchingGrabbable) && !_isTouchingWallAbove && !_isTouchingGrabbableAbove && !_isGrounded) { SwordCharaterStateMachine.ChangeState(SwordCharacter.LedgeCLimbState); } else if (SwordCharacterData.canWallJump && _jumpInput && _xInput == SwordCharacter.FacingDirection && (_isTouchingWall || _isTouchingGrabbable || _isTouchingWallBack)) { _isTouchingWall = SwordCharacter.CheckIfTouchingWall(); //update info in Update to increase accuracy _isTouchingGrabbable = SwordCharacter.CheckIfIsGrabbable(); SwordCharacter.WallJumpState.CheckWallJumpDirection(_isTouchingGrabbable || _isTouchingWall); SwordCharaterStateMachine.ChangeState(SwordCharacter.WallJumpState); } else if (SwordCharacterData.canDoubleJump && _jumpInput && SwordCharacter.JumpState.CanJump()) { SwordCharacter.Anim.SetTrigger("isDoubleJumpTrigger"); SwordCharaterStateMachine.ChangeState(SwordCharacter.JumpState); } else if (_isTouchingGrabbable && _grabInput && _isTouchingGrabbableAbove) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState); } else if ((_isTouchingWall || _isTouchingGrabbable) && _xInput == SwordCharacter.FacingDirection && SwordCharacter.CurrentVelocity.y <= 0 && SwordCharacterData.canSlide) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallSlideState); } else if (_dashInput && SwordCharacter.AirDashState.CheckIfCanDash()) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirDashState); } else { SwordCharacter.CheckIfShouldFlip(_xInput); SwordCharacter.SetVelocityX(SwordCharacterData.MovementVelocity * _xInput); SwordCharacter.Anim.SetFloat("yVelocity", SwordCharacter.CurrentVelocity.y); SwordCharacter.Anim.SetFloat("xVelocity", Mathf.Abs(SwordCharacter.CurrentVelocity.x)); } }
public override void LogicUpdate() { base.LogicUpdate(); if (isExitingState) { return; } if (XInput != 0) { SwordCharaterStateMachine.ChangeState(SwordCharacter.MoveState); } }
public override void LogicUpdate() { base.LogicUpdate(); if (isExitingState) { return; } SwordCharacter.SetVelocityY(-SwordCharacterData.WallSlideVelocity); if (GrabInput && IsTouchingGrabbable) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState); } }
public override void LogicUpdate() { base.LogicUpdate(); SwordCharacter.CheckIfShouldFlip(XInput); SwordCharacter.SetVelocityX(SwordCharacterData.MovementVelocity * XInput); if (isExitingState) { return; } if (XInput == 0) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } }
public override void LogicUpdate() { base.LogicUpdate(); if (isExitingState) { return; } if (XInput != 0) { SwordCharaterStateMachine.ChangeState(SwordCharacter.MoveState); } else if (isAnimationFinished) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } }
public override void LogicUpdate() { base.LogicUpdate(); XInput = SwordCharacter.InputHandler.InputX; _jumpInput = SwordCharacter.InputHandler.JumpInput; _dashInput = SwordCharacter.InputHandler.DashInput; if (IsAbilityDone) { if (IsGrounded && SwordCharacter.CurrentVelocity.y < 0.01f) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } if (!IsGrounded || SwordCharacter.CurrentVelocity.y > 0.01f) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (isExitingState) { return; } HoldPosition(); if (YInput > 0 && IsTouchingGrabbable && GrabInput && !IsTouchingWallAbove) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallClimbState); } if (YInput < 0 && IsTouchingGrabbable && GrabInput) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallClimbState); } if (!GrabInput) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } }
public override void LogicUpdate() { base.LogicUpdate(); if (isAnimationFinished) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } else { _xInput = SwordCharacter.InputHandler.InputX; _yInput = SwordCharacter.InputHandler.InputY; _jumpInput = SwordCharacter.InputHandler.JumpInput; SwordCharacter.SetVelocityZero(); if (!_isClimbing) { SwordCharacter.transform.position = _startPos; } else { SwordCharacter.transform.position = Vector3.MoveTowards(SwordCharacter.transform.position, _stopPos, SwordCharacterData.OffsetTransition * Time.deltaTime); } if (_xInput == SwordCharacter.FacingDirection && _isHanging && !_isClimbing && Time.time > _timer + _inputDelay) { _isClimbing = true; SwordCharacter.Anim.SetBool("ledgeClimbUp", true); } else if (_yInput == -1 && _isHanging && !_isClimbing) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } //else if(_jumpInput && !_isClimbing && Time.time > _timer + _inputDelay) //{ // SwordCharacter.WallJumpState.CheckWallJumpDirection(true); // SwordCharaterStateMachine.ChangeState(SwordCharacter.WallJumpState); //} } }
public override void LogicUpdate() { base.LogicUpdate(); if (isExitingState) { return; } if (YInput > 0 && IsTouchingGrabbable && GrabInput) { SwordCharacter.SetVelocityY(SwordCharacterData.WallClimbVelocity); } if (YInput < 0 && IsTouchingGrabbable && GrabInput) { SwordCharacter.SetVelocityY(-SwordCharacterData.WallClimbVelocity); } if (YInput == 0 && IsTouchingGrabbable && GrabInput || IsTouchingWallAbove && YInput > 0) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallGrabState); } //If player hold down while grabbing, it should stands idle else if (YInput < 0 && IsTouchingGrabbable && GrabInput && IsGrounded) { SwordCharaterStateMachine.ChangeState(SwordCharacter.IdleState); } //Smooth transition between climb and slide else if ((IsTouchingGrabbable || IsTouchingWall) && !GrabInput && XInput == SwordCharacter.FacingDirection) { SwordCharaterStateMachine.ChangeState(SwordCharacter.WallSlideState); } //If none of it is true just release from wall else if (!IsTouchingGrabbable) { SwordCharaterStateMachine.ChangeState(SwordCharacter.AirState); } }