public override void Update() { base.Update(); // if we've changed directions if (_input.XInputRaw == (_movement.FacingDirection * -1) && _weaponSystem.MeleeAttackState == MeleeAttackState.BeforeAttack) { // and we're still ramping up, switch directions _movement.Flip(); } // if we've received new attack input during the post attack period if (_attackInputBuffer && _weaponSystem.MeleeAttackState == MeleeAttackState.AfterAttack && _weaponSystem.AttackCount < _weaponData.MaxComboCount) { // if next attack will be our last attack, do the finisher if (_weaponSystem.AttackCount == _weaponData.MaxComboCount - 1) { FinisherAttack(); } // otherwise do another attack else { Attack(); } } }
public override void Enter() { Debug.Log("STATE: Wall Attack"); base.Enter(); _weaponSystem.AttackCompleted += OnAttackCompleted; _startPos = _movement.Position; //_movement.HoldPosition(_startPos); _movement.Flip(); _weaponSystem.StandardAttack(_weaponSystem.EquippedWeapon.WallAttack, _weaponSystem.EquippedWeapon.HitSFX, true); _movement.SetVelocityZero(); _movement.SetGravityScale(0); }
public override void Update() { base.Update(); // if we've changed directions if (_input.XInputRaw == (_movement.FacingDirection * -1) && _weaponSystem.MeleeAttackState == MeleeAttackState.BeforeAttack) { // and we're still ramping up, switch directions _movement.Flip(); } // if we've completed the attack and have attack input buffer, attack again else if (_attackInputBuffer && _weaponSystem.MeleeAttackState == MeleeAttackState.AfterAttack && _weaponSystem.AttackCount < _weaponData.MaxComboCount) { if (_input.YInputRaw < 0) { _stateMachine.ChangeState(_stateMachine.BounceAttackState); return; } else if (_weaponSystem.AttackCount == _weaponData.MaxComboCount - 1) { FinisherAttack(); } else { Attack(); } } }
private void HandleEndOfPath() { // idle if specified if (_data.IdleOnPathEnd) { _stateMachine.ChangeState(_stateMachine.IdleState); return; } // otherwise turn and continue else { _movement.Flip(); _movement.MoveX(_data.MovementSpeed * _movement.FacingDirection, true); // immediately detect new direction _groundInFrontDetector.Detect(); _wallDetector.Detect(); } }
public override void FixedUpdate() { base.FixedUpdate(); if (StateDuration >= _idleTime) { // if we detect space in front but are grounded, it's a ledge bool isLedge = !_groundInFrontDetector.IsDetected && _groundDetector.IsDetected; if (isLedge || _wallDetector.IsDetected) { _movement.Flip(); } _stateMachine.ChangeState(_stateMachine.MoveState); } if (_playerInRange.IsDetected) { _stateMachine.ChangeState(_stateMachine.PlayerDetectedState); } }
private void OnJumpPressed() { if (_wallDetector.IsDetected) { _stateMachine.ChangeState(_stateMachine.WallJumpState); return; } // test for wall jump else if (_wallDetector.IsDetected == false && _lateWallJumpAllowed) { // if we're facing away from the wall, flip before wall jumping _movement.Flip(); _stateMachine.ChangeState(_stateMachine.WallJumpState); return; } // otherwise do a normal air jump, if we have some remaining else if (_player.AirJumpsRemaining > 0) { _stateMachine.ChangeState(_stateMachine.AirJumpState); return; } }
public override void Enter() { base.Enter(); Debug.Log("STATE: Wall Jump"); _animator.PlayAnimation(PlayerAnimator.JumpName); _input.JumpPressed += OnJumpPressed; _input.DashPressed += OnDashPressed; _input.AttackPressed += OnAttackPressed; _isMoveInputAllowed = false; //_player.DecreaseAirJumpsRemaining(); Debug.Log("Remaining Jumps: " + _player.AirJumpsRemaining); // reverse direction _movement.SetVelocityZero(); _movement.Flip(); _movement.Move(_data.WallJumpVelocity, _data.WallJumpAngle, _movement.FacingDirection, false); _sfx.JumpSFX?.PlayOneShot(_player.transform.position); _jumpDust?.Play(); }
private void Turn() { _lastTurnTime = 0; _turnsCompleted++; _movement.Flip(); }
private void TurnAround() { _kinematicObject.Flip(); _kinematicObject.MoveX(_crawler.MovementSpeed * _kinematicObject.FacingDirection, true); }