예제 #1
0
    void FixedUpdate()
    {
        if (!_playerCentral.GetHitStun())
        {
            if (_iJump && _canJump)
            {
                _rb.velocity = Vector3.up * _jumpVelocity;
                _canJump     = false;
            }
            else
            {
                _rb.velocity = Vector3.up * _rb.velocity.y;
            }
            _iJump = false;

            if (_inputManager.GetHorizontal() != 0)
            {
                _rb.velocity += Vector3.right * _inputManager.GetHorizontal() * _velocity;
            }
            else if (_inputManager.GetVertical() != 0)
            {
                _rb.velocity += Vector3.forward * _inputManager.GetVertical() * _velocity;
            }
            else
            {
                _rb.velocity += Vector3.zero;
            }
        }
    }
예제 #2
0
    public void Damage(int damage)
    {
        if (!_playerCentral.GetHitStun())
        {
            _hp -= damage;
            _playerCentral.SetHitStun(true);
        }

        if (_hp <= 0)
        {
            InstaKill();
        }
    }