public override void Enter() { base.Enter(); SwordCharacter.SetVelocityZero(); SwordCharacter.transform.position = _detectedPos; _cornerPos = SwordCharacter.DetermineCornerPosition(); _startPos.Set(_cornerPos.x - (SwordCharacter.FacingDirection * SwordCharacterData.StartOffset.x), _cornerPos.y - SwordCharacterData.StartOffset.y); _stopPos.Set(_cornerPos.x + (SwordCharacter.FacingDirection * SwordCharacterData.StopOffset.x), _cornerPos.y + SwordCharacterData.StartOffset.y); SwordCharacter.transform.position = _startPos; }
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); //} } }
private void HoldPosition() { SwordCharacter.transform.position = _holdPosition; SwordCharacter.SetVelocityZero(); }