public override void FixedUpdate() { base.FixedUpdate(); _groundDetector.Detect(); // if attack is active propel forward, if it's in wepaon data if (_weaponSystem.MeleeAttackState == MeleeAttackState.DuringAttack && _hitDamageable) { // if we're holding forward, apply additional movement based on weapon settings if (_input.XInputRaw == _movement.FacingDirection) { // forward but disable falling _movement.MoveX((_weaponSystem.CurrentMeleeAttack.PlayerForwardAmount * _movement.FacingDirection) + (_movement.FacingDirection * _data.MoveSpeed) * _weaponSystem.CurrentMeleeAttack.MovementReductionRatio, false); } else { _movement.MoveX((_weaponSystem.CurrentMeleeAttack.PlayerForwardAmount * _movement.FacingDirection), false); } } // otherwise just move according to input else { _movement.MoveX(_input.XInputRaw * _data.MoveSpeed, true); } }
public override void FixedUpdate() { base.FixedUpdate(); // if we've reached a wall if (_wallDetector.IsDetected) { // turn around TurnAround(); // detect again in new direction to reset _wallDetector.Detect(); } // or a ledge else if (!_groundInFrontDetector.IsDetected) { // if there's no ground in front, but ground beneath, it's a ledge if (_groundDetector.Detect() != null) { TurnAround(); // detect in new direction to reset _groundInFrontDetector.Detect(); } } // otherwise, keep moving else { _kinematicObject.MoveX(_crawler.MovementSpeed * _kinematicObject.FacingDirection, true); } }
public override void FixedUpdate() { base.FixedUpdate(); _groundDetector.Detect(); _wallDetector.Detect(); // if we're not grounded, but began falling, go to fall state if (_groundDetector.IsDetected == false && _movement.Velocity.y < 0) { _stateMachine.ChangeState(_stateMachine.FallingState); return; } // otherwise we're against a wall but not holding input against else if (_wallDetector.IsDetected) { _stateMachine.ChangeState(_stateMachine.FallingState); return; } // if movement is now allowed, adjust player if (_isMoveInputAllowed) { _movement.MoveX(_input.XInputRaw * _data.MoveSpeed * _data.WallJumpMovementDampener, true); } else { _movement.MoveX(_data.MoveSpeed * _movement.FacingDirection, false); } }
public override void FixedUpdate() { base.FixedUpdate(); _groundDetector.Detect(); // if attack is active, propel forward based on weapon data forward amount if (_weaponSystem.MeleeAttackState == MeleeAttackState.DuringAttack) { // if we're holding forward, add additional movement based on our attacks move reduction if (_input.XInputRaw == _movement.FacingDirection) { float moveAmount = (_weaponSystem.CurrentMeleeAttack.PlayerForwardAmount * _movement.FacingDirection) + (_movement.FacingDirection * _data.MoveSpeed * _weaponSystem.CurrentMeleeAttack.MovementReductionRatio); //TODO: Consider if this can be a force with momentum, once we have that capability _movement.MoveX(moveAmount, false); } // otherwise just use forward amount else { float moveAmount = (_weaponSystem.CurrentMeleeAttack.PlayerForwardAmount * _movement.FacingDirection); _movement.MoveX(moveAmount, false); } } // otherwise no xinput, so don't move in x else { _movement.MoveX(0, false); } }
public override void Enter() { //Debug.Log("PATROLLER: Move State"); _movement.MoveX(_data.MovementSpeed * _movement.FacingDirection, true); _playerLOS.StartDetecting(); _wallDetector.StartDetecting(); _groundDetector.StartDetecting(); _groundInFrontDetector.StartDetecting(); }
public override void Move(MovementKM movement) { movement.MoveX(_moveSpeed * movement.FacingDirection, true); Vector3 newPosition = transform.right * _moveSpeed * Time.deltaTime; transform.position += newPosition; }
public override void FixedUpdate() { base.FixedUpdate(); if (_input.XInputRaw != 0) { _movement.MoveX(_data.MoveSpeed * _input.XInputRaw, true); } }
public override void Enter() { base.Enter(); _movement.MoveX(0, false); SetRandomIdleTime(); _playerInRange.StartDetecting(); _wallDetector.StartDetecting(); _groundDetector.StartDetecting(); _groundInFrontDetector.StartDetecting(); }
public override void FixedUpdate() { base.FixedUpdate(); _groundDetector.Detect(); // if we're not grounded, but began falling, go to fall state if (_movement.Velocity.y <= 0 && _isJumpLocked == false) { _stateMachine.ChangeState(_stateMachine.FallingState); return; } _movement.MoveX(_input.XInputRaw * _data.MoveSpeed, true); }
public override void Enter() { base.Enter(); _detectedGraphic.SetActive(true); _movement.MoveX(0, true); // wait for startup time before triggering the attack IsAttackActive = false; _isAttackSequenceComplete = false; if (_attackRoutine != null) { _stateMachine.StopCoroutine(_attackRoutine); } _attackRoutine = _stateMachine.StartCoroutine(AttackRoutine()); }
public override void FixedUpdate() { base.FixedUpdate(); _movement.MoveX(_data.ChargeSpeed * _movement.FacingDirection, true); // if there's a wall, go back to searching if (_wallDetector.IsDetected) { _stateMachine.ChangeState(_stateMachine.SearchState); return; } // or if there's a ledge, go back to searching else if (_groundInFrontDetector.IsDetected == false) { // if there's no ground in front, but we're grounded, it's a ledge if (_groundDetector.Detect() != null) { _stateMachine.ChangeState(_stateMachine.SearchState); return; } } // or if the player is in close range, attack! else if (_playerClose.IsDetected) { _stateMachine.ChangeState(_stateMachine.AttackState); return; } // if we've been charging too long, take a differnt action if (StateDuration >= _data.ChargeDuration) { // if player still detected, do it again if (_playerLOS.IsDetected) { _stateMachine.ChangeState(_stateMachine.PlayerDetectedState); return; } // otherwise transition back to patrol else { _stateMachine.ChangeState(_stateMachine.SearchState); return; } } }
public override void Enter() { base.Enter(); _lastTurnTime = 0; _turnsCompleted = 0; _movement.MoveX(0, false); // do the first turn immediately if (_data.TurnImmediatelyOnSearch && _data.NumberOfSearchTurns >= 1) { Turn(); } _playerLOS.StartDetecting(); }
public override void FixedUpdate() { base.FixedUpdate(); _groundDetector.Detect(); _wallDetector.Detect(); _aboveWallDetector.Detect(); // check for wall grab if (_wallDetector.IsDetected && _input.XInputRaw == _movement.FacingDirection) { Debug.Log("Wall detected!"); // determine if we can enter any of our wall states if (_data.AllowWallClimb) { _stateMachine.ChangeState(_stateMachine.WallClimbState); return; } else if (_data.AllowWallGrab) { _stateMachine.ChangeState(_stateMachine.WallGrabState); return; } else if (_data.AllowWallSlide) { _stateMachine.ChangeState(_stateMachine.WallSlideState); return; } } // check for grounded else if (_groundDetector.IsDetected && _movement.Velocity.y < 0.01f) { _stateMachine.ChangeState(_stateMachine.LandState); return; } _movement.MoveX(_input.XInputRaw * _data.MoveSpeed, true); }
public override void FixedUpdate() { base.FixedUpdate(); _ceilingDetector.Detect(); _movement.MoveX(_data.CrouchMoveVelocity * _input.XInputRaw, true); // if we're not holding down and holding either direction // AND we're not touching the ceiling if (_input.YInputRaw != -1 && _input.XInputRaw != 0 && _ceilingDetector.IsDetected == false) { _stateMachine.ChangeState(_stateMachine.MoveState); return; } // if we're not holding down or side directions, and not touching the ceiling else if (_input.YInputRaw >= 0 && _input.XInputRaw == 0 && _ceilingDetector.IsDetected == false) { _stateMachine.ChangeState(_stateMachine.IdleState); return; } }
private void OnHitRecovered() { _movement.MoveX(0, false); _stateMachine.ChangeState(_stateMachine.SearchState); }
public override void FixedUpdate() { base.FixedUpdate(); _movement.MoveX(_input.XInputRaw * _data.MoveSpeed, true); }