public override void FixedUpdate()
    {
        base.FixedUpdate();
        // using the dash in update so that we don't trigger a state change while we're still entering
        _groundDetector.Detect();

        // otherwise use dash values
        _movement.Move(_dashDirection * _data.DashVelocity, false);
    }
Exemple #2
0
    public override void FixedUpdate()
    {
        base.FixedUpdate();

        // if there is an object to chase, chase it
        if (_playerInRange.IsDetected && _objectToChase != null)
        {
            Vector2 direction = (_objectToChase.position
                                 - _flyer.transform.position).normalized;
            _movement.Move(direction * _flyer.ChaseSpeed, true);
        }
        // otherwise we lost the object
        else
        {
            _stateMachine.ChangeState(_stateMachine.ReturningState);
            return;
        }
    }
Exemple #3
0
    public override void FixedUpdate()
    {
        base.FixedUpdate();

        // move back towards start
        Vector2 direction = (_flyer.StartPosition
                             - _flyer.transform.position).normalized;

        _movement.Move(direction * _flyer.ReturnSpeed, true);

        // check if we've returned to start
        if (Vector2.Distance(_flyer.StartPosition, _flyer.transform.position)
            <= 1)
        {
            // we've returned to our starting point
            _flyer.Movement.MovePositionInstant(_flyer.transform.position);
            _stateMachine.ChangeState(_stateMachine.IdleState);
            return;
        }
    }
Exemple #4
0
    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();
    }
Exemple #5
0
 public override void FixedUpdate()
 {
     base.FixedUpdate();
     _movement.Move(0, 0, false);
     //_movement.HoldPosition(_startPosition);
 }