public override void LogicUpdate() { base.LogicUpdate(); XInput = Player.InputHandler.NormalizedInputX; YInput = Player.InputHandler.NormalizedInputY; GrabInput = Player.InputHandler.GrabInput; JumpInput = Player.InputHandler.JumpInput; if (JumpInput) { Player.WallJumpState.DetermineWallJumpDirection(IsTouchingWall); FiniteStateMachine.ChangeCurrentState(Player.WallJumpState); } else if (IsGrounded && !GrabInput) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } else if (!IsTouchingWall || (XInput != Player.FacingDirection && !GrabInput)) { FiniteStateMachine.ChangeCurrentState(Player.InAirState); } else if (IsTouchingWall && !IsTouchingLedge) { FiniteStateMachine.ChangeCurrentState(Player.LedgeClimbState); } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { Player.SetVelocityY(-_wallSlideData.wallSlideVelocity); if (GrabInput && YInput == 0) { FiniteStateMachine.ChangeCurrentState(Player.WallGrabState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { Player.SetVelocityY(_wallClimbStateData.wallClimbVelocity); if (YInput != 1) { FiniteStateMachine.ChangeCurrentState(Player.WallGrabState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { if (XInput != 0) { FiniteStateMachine.ChangeCurrentState(Player.MoveState); } else if (IsAnimationFinished) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { if (!CrouchInput && YInput != -1 && !_isTouchingCeiling) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } else if (XInput != 0) { FiniteStateMachine.ChangeCurrentState(Player.CrouchMoveState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { if (XInput != 0) { FiniteStateMachine.ChangeCurrentState(Player.MoveState); } else if (CrouchInput || YInput == -1) { FiniteStateMachine.ChangeCurrentState(Player.CrouchIdleState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (Time.time >= Player.StatsManager.LastDamageTime + _stunStateData.stunRecorveryTime) { Player.StatsManager.ExitStun(); if (_isGrounded && Player.CurrentVelocity.y < 0.01f) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } else { FiniteStateMachine.ChangeCurrentState(Player.InAirState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { HoldPosition(); if (YInput > 0) { FiniteStateMachine.ChangeCurrentState(Player.WallClimbState); } else if (YInput < 0) { FiniteStateMachine.ChangeCurrentState(Player.WallSlideState); } } }
public override void LogicUpdate() { base.LogicUpdate(); XInput = Player.InputHandler.NormalizedInputX; YInput = Player.InputHandler.NormalizedInputY; CrouchInput = Player.InputHandler.CrouchInput; _jumpInput = Player.InputHandler.JumpInput; _grabInput = Player.InputHandler.GrabInput; _dashInput = Player.InputHandler.DashInput; _rollInput = Player.InputHandler.RollInput; _primaryAttackInput = Player.InputHandler.PrimaryInput; _secondaryAttackInput = Player.InputHandler.SecondaryInput; if (_primaryAttackInput && !_isTouchingCeiling) { FiniteStateMachine.ChangeCurrentState(Player.SwordAttackState01); } else if (_secondaryAttackInput && Player.SkillManager.GetCurrentSkill().CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.SkillManager.GetCurrentSkill()); } else if (_jumpInput && Player.JumpState.CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.JumpState); } else if (!_isGrounded && Player.CurrentVelocity.y < 0.01f) { Player.InAirState.StartCoyoteTime(); FiniteStateMachine.ChangeCurrentState(Player.InAirState); } else if (_isTouchingWall && _grabInput && _isTouchingLedge) { FiniteStateMachine.ChangeCurrentState(Player.WallGrabState); } else if (_dashInput && Player.DashState.CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.DashState); } else if (_rollInput && !_isTouchingCeiling && Player.RollState.CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.RollState); } }
public override void LogicUpdate() { base.LogicUpdate(); if (!IsExitingState) { Player.CheckIfShouldFlip(XInput); Player.SetVelocityX(_moveStateData.movementVelocity * XInput); if (XInput == 0) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } else if (CrouchInput || YInput == -1) { FiniteStateMachine.ChangeCurrentState(Player.CrouchMoveState); } } }
public override void LogicUpdate() { base.LogicUpdate(); Player.CheckIfShouldFlip(XInput); Player.SetVelocityX(_crouchMoveStateData.crouchMovementVelocity * XInput); if (!IsExitingState) { if (!CrouchInput && YInput != -1 && !_isTouchingCeiling) { FiniteStateMachine.ChangeCurrentState(Player.MoveState); } else if (XInput == 0) { FiniteStateMachine.ChangeCurrentState(Player.CrouchIdleState); } } }
public override void LogicUpdate() { base.LogicUpdate(); if (IsAbilityDone) { Debug.Log("Ability is done"); if (IsTouchingCeiling) { FiniteStateMachine.ChangeCurrentState(Player.CrouchIdleState); } else if (IsGrounded && Player.CurrentVelocity.y < 0.01f) { FiniteStateMachine.ChangeCurrentState(Player.IdleState); } else if (!IsGrounded) { FiniteStateMachine.ChangeCurrentState(Player.InAirState); } } }
public void Damage(AttackDetails attackDetails) { if (StatsManager.IsRolling || StatsManager.IsDead) { return; } StatsManager.TakeDamage(attackDetails); foreach (GameObject effect in _damageStateData.damageEffects) { Instantiate(effect, AliveGameObject.transform.position, effect.transform.rotation); } if (StatsManager.IsDead) { FiniteStateMachine.ChangeCurrentState(DeadState); } else if (StatsManager.IsStunned && FiniteStateMachine.CurrentState != StunState) { FiniteStateMachine.ChangeCurrentState(StunState); } }
public override void LogicUpdate() { base.LogicUpdate(); CheckCoyoteTime(); CheckWallJumpCoyoteTime(); _xInput = Player.InputHandler.NormalizedInputX; _jumpInput = Player.InputHandler.JumpInput; _jumpInputStop = Player.InputHandler.JumpInputStop; _grabInput = Player.InputHandler.GrabInput; _dashInput = Player.InputHandler.DashInput; _primaryAttackInput = Player.InputHandler.PrimaryInput; _secondaryAttackInput = Player.InputHandler.SecondaryInput; CheckJumpHeightMultiplier(); if (_primaryAttackInput) { FiniteStateMachine.ChangeCurrentState(Player.SwordAttackState01); } else if (_secondaryAttackInput && Player.SkillManager.GetCurrentSkill().CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.SkillManager.GetCurrentSkill()); } else if (_isTouchingWall && _xInput == Player.FacingDirection && Player.CurrentVelocity.y <= 0) { FiniteStateMachine.ChangeCurrentState(Player.WallSlideState); } else if (_isTouchingWall && !_isTouchingLedge && !_isGrounded) { FiniteStateMachine.ChangeCurrentState(Player.LedgeClimbState); } else if (_jumpInput && (_isTouchingWall || _isBackTouchingWall || _wallJumpCoyoteTime)) { StopWallJumpCoyoteTime(); _isTouchingWall = Player.CheckIfTouchingWall(); Player.WallJumpState.DetermineWallJumpDirection(_isTouchingWall); FiniteStateMachine.ChangeCurrentState(Player.WallJumpState); } else if (_jumpInput && Player.JumpState.CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.JumpState); } else if (_isTouchingWall && _grabInput && _isTouchingLedge) { FiniteStateMachine.ChangeCurrentState(Player.WallGrabState); } else if (_isGrounded & Player.CurrentVelocity.y < 0.01f) { FiniteStateMachine.ChangeCurrentState(Player.LandState); } else if (_dashInput && Player.DashState.CanUseAbility()) { FiniteStateMachine.ChangeCurrentState(Player.DashState); } else { Player.CheckIfShouldFlip(_xInput); Player.SetVelocityX(_inAirStateData.movementVelocity * _xInput); Player.MyAnmator.SetFloat("yVelocity", Player.CurrentVelocity.y); Player.MyAnmator.SetFloat("xVelocity", Mathf.Abs(Player.CurrentVelocity.x)); } }