public void TakeDamage(float amount)
        {
            if (invulnerabilityCooldown > 0)
            {
                return;
            }

            currentHitpoints       -= amount;
            invulnerabilityCooldown = Invulnerability;
            ModelChildEntity.Get <ModelComponent>().Enabled = false;

            if (currentHitpoints <= 0)
            {
                Die();
            }
        }
        public override void Update()
        {
            if (Character == null)
            {
                return;
            }

            if (!isAlive)
            {
                WaitingToRespawn();
                return;
            }

            var dt = (float)Game.UpdateTime.Elapsed.TotalSeconds;

            if (invulnerabilityCooldown > 0)
            {
                invulnerabilityCooldown -= dt;
                if (invulnerabilityCooldown <= 0)
                {
                    ModelChildEntity.Get <ModelComponent>().Enabled = true;
                }
                else
                {
                    ModelChildEntity.Get <ModelComponent>().Enabled = !ModelChildEntity.Get <ModelComponent>().Enabled;
                }
            }

            // Jump
            if (ControlInput.Jump)
            {
                if (Character.IsGrounded)
                {
                    jumpSfxInstance?.Stop();
                    Character.Jump();
                    jumpSfxInstance?.Play();
                }
            }

            // Left stick: movement
            var moveDirection = ControlInput.WalkDirection;

            // Broadcast the movement vector as a world-space Vector3 to allow characters to be controlled
            var worldSpeed = (Camera != null)
                ? Utils.LogicDirectionToWorldDirection(moveDirection, Camera, Vector3.UnitY)
                : new Vector3(moveDirection.X, 0, moveDirection.Y);

            Character.SetVelocity(worldSpeed * MaxRunSpeed);

            // Facing direction
            if (ModelChildEntity == null)
            {
                return;
            }

            // Character orientation
            if (moveDirection.Length() > 0.001)
            {
                yawOrientation = MathUtil.RadiansToDegrees((float)Math.Atan2(worldSpeed.Z, -worldSpeed.X) + MathUtil.PiOverTwo);
            }

            // Left stick: movement
            var faceDirection = ControlInput.FaceDirection;

            if (faceDirection.Length() > 0.001)
            {
                // Broadcast the movement vector as a world-space Vector3 to allow characters to be controlled
                var worldFacing = (Camera != null)
                    ? Utils.LogicDirectionToWorldDirection(faceDirection, Camera, Vector3.UnitY)
                    : new Vector3(faceDirection.X, 0, faceDirection.Y);

                if (faceDirection.Length() > 0.001)
                {
                    yawOrientation =
                        MathUtil.RadiansToDegrees((float)Math.Atan2(worldFacing.Z, -worldFacing.X) + MathUtil.PiOverTwo);
                }
            }

            if (MachineGun != null)
            {
                var canShoot = ControlInput.Shoot & !ControlInput.Attack;
                if (Sword != null)
                {
                    canShoot &= Sword.SwingCooldown <= 0;
                }
                MachineGun.IsShooting = canShoot;
            }

            if (Sword != null && ControlInput.Attack)
            {
                Sword.Slash();
            }

            ModelChildEntity.Transform.Rotation = Quaternion.RotationYawPitchRoll(MathUtil.DegreesToRadians(yawOrientation), 0, 0);
        }