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; } } }
public void Damage(int damage) { if (!_playerCentral.GetHitStun()) { _hp -= damage; _playerCentral.SetHitStun(true); } if (_hp <= 0) { InstaKill(); } }