private void ServerUpdate()
        {
            if (!isServer)
            {
                return;
            }

            _nextShootTick += Time.fixedDeltaTime;
            if (_nextShootTick / _currentShootRate >= 1)
            {
                ShootAtPlayer();

                _nextShootTick    = 0;
                _currentShootRate = useConstantRate ? fireRate : Random.Range(minFireRate, maxFireRate);
            }

            MoveSpaceship();
            _screenWrapper.CheckObjectOutOfScreen();

            Vector3 position = transform.position;

            float percentX = ExtensionFunctions.Map(position.x, _screenWrapper.LeftMostPoint,
                                                    _screenWrapper.RightMostPoint, -1, 1);
            float percentY = ExtensionFunctions.Map(position.y, _screenWrapper.TopMostPoint,
                                                    _screenWrapper.BottomMostPoint, 1, -1);

            _nextTick += Time.fixedDeltaTime;
            if (_nextTick / updateSendRate >= 1)
            {
                RpcLocalClientSpaceshipPositionFixer(percentX, percentY, _spaceshipRb.velocity, Time.time);
                _nextTick = 0;
            }
        }
Example #2
0
        private void SetSmokeBasedOnHealth()
        {
            float healthRatio = _healthSetter.GetCurrentHealth() / _healthSetter.maxHealthAmount;

            if (healthRatio > thresholdHealthRatio)
            {
                return;
            }

            if (_smokeParticles.Count == 0)
            {
                GameObject smokeInstance = Instantiate(droneDamageSmoke,
                                                       smokeSpawnPoint.position, droneDamageSmoke.transform.rotation);
                smokeInstance.transform.SetParent(smokeSpawnPoint);

                _smokeParticles = smokeInstance.GetComponentsInChildren <ParticleSystem>().ToList();
            }

            foreach (ParticleSystem particle in _smokeParticles)
            {
                float mappedEmissionRate = ExtensionFunctions.Map(
                    healthRatio,
                    thresholdHealthRatio, 0,
                    minParticles, maxParticles
                    );

                ParticleSystem.EmissionModule emission = particle.emission;
                emission.rateOverTime = mappedEmissionRate;
            }
        }
Example #3
0
        public void PlaceTreesOnPoints()
        {
            hasPlacedTrees = true;
            var maxValue = float.MinValue;

            for (var i = 0; i < _treePoints.Length; i++)
            {
                if (_treePoints[i].y > maxValue)
                {
                    maxValue = _treePoints[i].y;
                }
            }

            for (var i = 0; i < _treePoints.Length; i++)
            {
                if (_treePoints[i] == Vector3.zero)
                {
                    Debug.Log("Tree At Zero");
                }

                var normalizedPoint = ExtensionFunctions.Map(_treePoints[i].y, 0, maxValue,
                                                             0, 1);
                _trees[i] = TreesManager.instance.RequestTree(normalizedPoint);

                if (_trees[i] != null)
                {
                    _trees[i].transform.position = _treePoints[i] + _meshCenter;
                    if (_treeSettings.useRandomTreeRotation)
                    {
                        _trees[i].transform.rotation = Quaternion.Euler(0, Random.Range(0, 360), 0);
                    }
                    _trees[i].SetActive(true);
                }
            }
        }
        private void CheckAndPickUpCannon()
        {
            if (!_cannonSpawned)
            {
                return;
            }

            if (Input.GetKey(Controls.CannonSpawnKey) && _cannonInRange)
            {
                _currentCollectionTime  -= Time.deltaTime;
                _displayImage.enabled    = true;
                _displayImage.fillAmount =
                    ExtensionFunctions.Map(_currentCollectionTime, 0, collectionTime, 0, 1);

                if (_currentCollectionTime <= 0)
                {
                    _cannonInstance.SetActive(false);
                    _cannonSpawned = false;
                    _cannonInRange = false;
                    ResetTimerImage();
                }
            }
            else if (!Input.GetKey(Controls.CannonSpawnKey))
            {
                ResetTimerImage();
            }
        }
Example #5
0
    public void UpdateHealth()
    {
        float currentHealthRatio = currentCarHealth / maxCarHealth;

        if (currentHealthRatio >= healthRatioToSpawnFire)
        {
            return;
        }

        if (vehicleFireParticleSystem.Count == 0)
        {
            GameObject vehicleFireInstance = Instantiate(vehicleFire,
                                                         vehicleFireSpawnPoint.transform.position,
                                                         vehicleFire.transform.rotation);
            vehicleFireInstance.transform.SetParent(gameObject.transform);

            vehicleFireParticleSystem.Add(vehicleFireInstance.
                                          transform.GetChild(0).GetComponent <ParticleSystem>());
            vehicleFireParticleSystem.Add(vehicleFireInstance.
                                          transform.GetChild(1).GetComponent <ParticleSystem>());
        }

        foreach (ParticleSystem item in vehicleFireParticleSystem)
        {
            float mappedEmission = ExtensionFunctions.Map(currentHealthRatio,
                                                          healthRatioToSpawnFire, 0,
                                                          minFireParticles, maxFireParticles);

            ParticleSystem.EmissionModule emission = item.emission;
            emission.rateOverTime = mappedEmission;
        }
    }
Example #6
0
        private void LocalClientUpdate()
        {
            if (isServer)
            {
                return;
            }

            float timestamp = Time.time;

            if (isPredictionEnabled)
            {
                _screenWrapper.CheckObjectOutOfScreen();
                Vector2 position = transform.position;

                _predictedPackages.Add(new PositionTimestampReceivePackage
                {
                    percentX = ExtensionFunctions.Map(position.x, _screenWrapper.LeftMostPoint,
                                                      _screenWrapper.RightMostPoint, -1, 1),
                    percentY = ExtensionFunctions.Map(position.y, _screenWrapper.TopMostPoint,
                                                      _screenWrapper.BottomMostPoint, 1, -1),

                    timestamp = timestamp
                });
            }
        }
Example #7
0
        private void FloatingScaleChange(float delta)
        {
            float scaleMultiplier = Mathf.Sin(scaleChangeFrequency * _playerTime);
            float scaleAmount     = ExtensionFunctions.Map(scaleMultiplier, -1, 1, minScaleAmount, maxScaleAmount);

            _targetScale = Vector2.One * scaleAmount;
        }
Example #8
0
        public void MakePlayerMoveToDestination(Vector3 targetPosition)
        {
            float currentBelief = BeliefController.Instance.CurrentBeliefAmount;
            float maxBelief     = BeliefController.Instance.MaxBeliefAmount;

            float beliefRatio       = currentBelief / maxBelief;
            float mappedClickWeight = ExtensionFunctions.Map(beliefRatio, 0, 1, minPlayerClickWeight, 1);

            float maxModifierWeight = mappedClickWeight;
            PlayerMovementInterestModifier maxModifier = null;

            foreach (PlayerMovementInterestModifier playerMovementInterestModifier in _playerMovementInterestModifiers)
            {
                if (playerMovementInterestModifier.CanModifierAffect(maxModifierWeight))
                {
                    maxModifierWeight = playerMovementInterestModifier.InterestModifierWeight;
                    maxModifier       = playerMovementInterestModifier;
                }
            }

            if (!maxModifier)
            {
                playerMovement.MovePlayerToPosition(targetPosition);
            }
            else
            {
                playerMovement.MovePlayerToPosition(maxModifier.GetTargetPosition());
                maxModifier.SetModifierUsed();
            }
        }
Example #9
0
    public void PlaceTreesOnPoints()
    {
        hasPlacedTrees = true;
        float maxValue = float.MinValue;

        for (int i = 0; i < treePoints.Length; i++)
        {
            if (treePoints[i].y > maxValue)
            {
                maxValue = treePoints[i].y;
            }
        }

        for (int i = 0; i < treePoints.Length; i++)
        {
            float normalizedPoint = ExtensionFunctions.Map(treePoints[i].y, 0, maxValue, 0, 1);
            trees[i] = TreesManager.instance.RequestTree(normalizedPoint);

            if (trees[i] != null)
            {
                trees[i].transform.position = treePoints[i] + _meshCenter;
                trees[i].SetActive(true);
            }
        }
    }
Example #10
0
        private void ShootChargedBullet()
        {
            if (_chargedShotBullet == null)
            {
                return;
            }

            _playerChargedShotShootingPosition.RemoveChild(_chargedShotBullet);
            _playerBulletHolder.AddChild(_chargedShotBullet);

            float maxDamage    = _chargedShotBullet.GetBulletDamage() + _currentDamageDiff;
            float mappedDamage = ExtensionFunctions.Map(_chargeWeaponCurrentScale,
                                                        0, chargeGunMaxScaleAmount, 0, maxDamage);

            _chargedShotBullet.SetBulletDamage(mappedDamage);
            _chargedShotBullet.SetGlobalPosition(_playerChargedShotShootingPosition.GetGlobalPosition());
            _chargedShotBullet.SetGlobalScale(Vector2.One * _chargeWeaponCurrentScale);

            float currentRotation = _playerRoot.GetRotation();

            _chargedShotBullet.SetGlobalRotation(currentRotation);

            _chargedShotBullet.SetAsDynamicBullet();
            _chargedShotBullet.SetMode(RigidBody2D.ModeEnum.Rigid);

            float xVelocity = Mathf.Cos(currentRotation);
            float yVelocity = Mathf.Sin(currentRotation);

            _chargedShotBullet.LaunchBullet(new Vector2(xVelocity, yVelocity).Normalized());

            _chargedShotBullet = null;

            bulletShot?.Invoke(_currentWeaponType);
        }
Example #11
0
        public void Update(float deltaTime)
        {
            float ratio = _currentValue / _maxValue;

            _barHeight = ExtensionFunctions.Map(ratio, 0, 1, 0, _maxTopBarHeight);

            _topBar.SetSize((int)_topBar.ScaledWidth, (int)_barHeight);
        }
Example #12
0
        public override void _Process(float delta)
        {
            float currentYPosition = GetGlobalPosition().y;
            float clampedYPosition = Mathf.Clamp(currentYPosition, minYPosition, maxYPosition);

            SetSelfModulate(_currentColor.LinearInterpolate(endColor,
                                                            ExtensionFunctions.Map(clampedYPosition, minYPosition, maxYPosition, 0, 1)));
        }
Example #13
0
        /// <summary>
        /// Update is called every frame, if the MonoBehaviour is enabled.
        /// </summary>
        void Update()
        {
            float maxVelocity     = _creatureAgent.speed * _creatureAgent.speed;
            float currentVelocity = _creatureAgent.velocity.sqrMagnitude;

            float movementSpeed = ExtensionFunctions.Map(currentVelocity, 0, maxVelocity, 0, 1);

            _creatureAnimator.SetFloat(AnimatorMovement, movementSpeed);
        }
Example #14
0
        private void Update()
        {
            var maxVelocity     = _droidAgent.speed * _droidAgent.speed;
            var currentVelocity = _droidAgent.velocity.sqrMagnitude;

            var movementSpeed = ExtensionFunctions.Map(currentVelocity, 0, maxVelocity,
                                                       0, 1);

            droidAnimator.SetFloat(AnimatorMovement, movementSpeed);
        }
Example #15
0
 public void HealHealth(int amt)
 {
     currentHealth      += amt;
     greenBar.localScale = new Vector3(Mathf.Clamp(ExtensionFunctions.Map((float)currentHealth, 0f, (float)maxHealth, 0f, 1f), 0f, 1f), greenBar.localScale.y, greenBar.localScale.z);
     greenBarX           = greenBar.localScale.x + ExtensionFunctions.Map(amt, 0, maxHealth, 0, 1);
     StopCoroutine(LerpGreenBar());
     if (gameObject.activeSelf)
     {
         StartCoroutine(LerpGreenBar());
     }
 }
Example #16
0
        private void Initialize()
        {
            if (_initialized)
            {
                return;
            }

            _initialized  = true;
            _fadeImage    = GetComponent <Image>();
            _currentAlpha = ExtensionFunctions.Map(_fadeImage.color.a, 0, 1, 0, 255);
        }
Example #17
0
        private void ZoomCamera()
        {
            float mappedDistance = ExtensionFunctions.Map(
                GetGreatestDistance(),
                minDistanceAmount,
                maxDistanceAmount,
                1, 0
                );
            float newZoom = Mathf.Lerp(maxZoomDistance, minZoomDistance, mappedDistance);

            mainCamera.fieldOfView = Mathf.Lerp(mainCamera.fieldOfView, newZoom, Time.deltaTime * zoomLerpSpeed);
        }
Example #18
0
        private void Update()
        {
            var droidSpeed      = _droidAgent.speed;
            var maxVelocity     = droidSpeed * droidSpeed;
            var currentVelocity = _droidAgent.velocity.sqrMagnitude;

            var rotationSpeed = ExtensionFunctions.Map(currentVelocity, 0, maxVelocity,
                                                       0, rotationSpeedMaxVelocity);

            leftWheel.transform.Rotate(Vector3.up * rotationSpeed * Time.deltaTime, Space.Self);
            rightWheel.transform.Rotate(Vector3.down * rotationSpeed * Time.deltaTime, Space.Self);
        }
Example #19
0
    public void SpawnLargeSpaceship()
    {
        float randomY = ExtensionFunctions.Map(Random.value, 0, 1,
                                               _bottomRight.y, _topLeft.y);

        GameObject largeSpaceshipInstance = Instantiate(largeSpaceship,
                                                        new Vector3(_topLeft.x - 2, randomY), Quaternion.identity);

        largeSpaceshipInstance.transform.SetParent(_spaceshipHolder);

        NetworkServer.Spawn(largeSpaceshipInstance);
    }
Example #20
0
        private void UpdateUIAndMusic()
        {
            float chaosRatio = _chaosLevel / (float)maxChaosLevel;

            chaosImage.fillAmount = chaosRatio;
            backgroundMusic.pitch = ExtensionFunctions.Map(
                chaosRatio,
                0, 1,
                minAudioPitch, maxAudioPitch
                );

            chaosText.text = $"{_chaosLevel} / {maxChaosLevel}\nChaos Level";
        }
        private void ServerUpdate()
        {
            // isLocalPlayer added to make sure that the server is just used for computation
            // and not for anything else. Its a dumb dedicated sever
            if (!isServer || isLocalPlayer)
            {
                return;
            }

            InputSendPackage inputSendPackageData = PacketManager.GetNextDataReceived();

            if (inputSendPackageData == null)
            {
                return;
            }

            RotatePlayer(inputSendPackageData.horizontal);
            MovePlayerForward(inputSendPackageData.vertical);
            SetMovementAnimation(inputSendPackageData.vertical);
            _screenWrapper.CheckObjectOutOfScreen();

            if (_lastPosition == transform.position && _lastRotation == transform.rotation.eulerAngles)
            {
                return;
            }

            Vector3 position = transform.position;
            Vector3 rotation = transform.rotation.eulerAngles;
            Vector3 velocity = _playerRb.velocity;

            ServerPacketManager.AddPackage(new PositionReceivePackage
            {
                percentX = ExtensionFunctions.Map(position.x, _screenWrapper.LeftMostPoint,
                                                  _screenWrapper.RightMostPoint, -1, 1),
                percentY = ExtensionFunctions.Map(position.y, _screenWrapper.TopMostPoint,
                                                  _screenWrapper.BottomMostPoint, 1, -1),

                velocityX = velocity.x,
                velocityY = velocity.y,

                rotationZ = rotation.z,
                roll      = _roll,

                movementAnimation = inputSendPackageData.vertical > 0,

                timestamp = inputSendPackageData.timestamp
            });

            _lastPosition = position;
            _lastRotation = rotation;
        }
Example #22
0
    public void TakeDamage(int amt)
    {
        currentHealth      -= amt;
        greenBar.localScale = new Vector3(Mathf.Clamp(ExtensionFunctions.Map((float)currentHealth, 0f, (float)maxHealth, 0f, 1f), 0f, 1f), greenBar.localScale.y, greenBar.localScale.z);
        greenBarX           = greenBar.localScale.x;
        StopCoroutine(LerpYellowBar());
        if (gameObject.activeSelf)
        {
            StartCoroutine(LerpYellowBar());
        }

        //Wouter PlayerTakesDmg
        FMODUnity.RuntimeManager.PlayOneShot("event:/Player/PlayerTakesDmg");
    }
        private void LocalClientUpdate()
        {
            if (!isLocalPlayer || isServer)
            {
                return;
            }

            float moveZ     = Input.GetAxis(Controls.PlayerVM);
            float moveX     = Input.GetAxis(Controls.PlayerHM);
            float timestamp = Time.time;

            if (isPredictionEnabled)
            {
                RotatePlayer(moveX);
                MovePlayerForward(moveZ);
                SetMovementAnimation(moveZ);
                _screenWrapper.CheckObjectOutOfScreen();

                Vector3 position = transform.position;
                Vector3 rotation = transform.rotation.eulerAngles;
                Vector3 velocity = _playerRb.velocity;

                _predictedPackages.Add(new PositionReceivePackage
                {
                    percentX = ExtensionFunctions.Map(position.x, _screenWrapper.LeftMostPoint,
                                                      _screenWrapper.RightMostPoint, -1, 1),
                    percentY = ExtensionFunctions.Map(position.y, _screenWrapper.TopMostPoint,
                                                      _screenWrapper.BottomMostPoint, 1, -1),

                    velocityX = velocity.x,
                    velocityY = velocity.y,

                    rotationZ = rotation.z,
                    roll      = _roll,

                    movementAnimation = moveZ > 0,

                    timestamp = timestamp,
                });
            }

            PacketManager.AddPackage(new InputSendPackage
            {
                horizontal = moveX,
                vertical   = moveZ,

                timestamp = timestamp
            });
        }
Example #24
0
        private void UpdateLocomotionAnimation()
        {
            if (playerAgent.velocity.sqrMagnitude == 0)
            {
                playerAnimator.SetFloat(MovementParam, 0);
                _targetMovementSpeed = _walkingSpeed;
            }
            else
            {
                _targetMovementSpeed  = playerMovement.IsPlayerRunning() ? _runningSpeed : _walkingSpeed;
                _targetMovementSpeed  = ExtensionFunctions.Map(_targetMovementSpeed, _walkingSpeed, _runningSpeed, minAnimationAffectValue, 1);
                _currentMovementSpeed = Mathf.Lerp(_currentMovementSpeed, _targetMovementSpeed, locomotionLerpRate * Time.deltaTime);

                playerAnimator.SetFloat(MovementParam, _currentMovementSpeed);
            }
        }
Example #25
0
        public void CreateAsteroidsAtScreenEdge()
        {
            if (!isServer)
            {
                return;
            }

            if (_asteroidsHolder == null)
            {
                _asteroidsHolder = GameObject.FindGameObjectWithTag(TagManager.AsteroidsHolder)?.transform;
            }

            Camera  mainCamera  = Camera.main;
            Vector3 topLeft     = mainCamera.ScreenToWorldPoint(new Vector2(0, mainCamera.pixelHeight));
            Vector3 bottomRight =
                mainCamera.ScreenToWorldPoint(new Vector2(mainCamera.pixelWidth, 0));

            _currentSpawnCount = _currentSpawnCount + 1 > maxSpawnCount ? maxSpawnCount : _currentSpawnCount + 1;

            // Left Asteroids
            for (int i = 0; i < _currentSpawnCount / 2 + 1; i++)
            {
                float randomHeight = ExtensionFunctions.Map(Random.value, 0, 1,
                                                            bottomRight.y, topLeft.y);

                GameObject asteroidInstance = Instantiate(asteroidPrefab,
                                                          new Vector2(topLeft.x + leftRightOffset, randomHeight),
                                                          Quaternion.identity);
                asteroidInstance.transform.SetParent(_asteroidsHolder);

                NetworkServer.Spawn(asteroidInstance);
            }

            // Right Asteroids
            for (int i = 0; i < _currentSpawnCount / 2 + 1; i++)
            {
                float randomHeight = ExtensionFunctions.Map(Random.value, 0, 1,
                                                            bottomRight.y, topLeft.y);

                GameObject asteroidInstance = Instantiate(asteroidPrefab,
                                                          new Vector2(bottomRight.x - leftRightOffset, randomHeight),
                                                          Quaternion.identity);
                asteroidInstance.transform.SetParent(_asteroidsHolder);

                NetworkServer.Spawn(asteroidInstance);
            }
        }
    /// <summary>
    /// This function moves the character according to an animation curve defined pubicly
    /// </summary>
    private IEnumerator Dash()
    {
        Vector2 DashPos = Vector2.zero;
        float   t       = 0f;
        int     moveDir = (isFacingRight) ? 1 : -1;
        float   curveValue;

        DashPos.x = transform.position.x + dashDistance * moveDir;

        while (t < dashUptime)
        {
            t         += Time.deltaTime;
            curveValue = animC.Evaluate(ExtensionFunctions.Map(t, 0, dashUptime, 0, 1));
            Debug.Log(curveValue);
            rb2D.MovePosition(Vector3.Lerp(transform.position, new Vector2(DashPos.x, transform.position.y), curveValue / dashUptime));
            yield return(null);
        }
    }
Example #27
0
        private void RpcLocalClientBulletPositionFixer(float percentX, float percentY, Vector2 velocity,
                                                       float timestamp)
        {
            if (isServer)
            {
                return;
            }

            Vector2 normalizedPosition = new Vector2(
                ExtensionFunctions.Map(percentX, -1, 1,
                                       _screenWrapper.LeftMostPoint, _screenWrapper.RightMostPoint),
                ExtensionFunctions.Map(percentY, 1, -1,
                                       _screenWrapper.TopMostPoint, _screenWrapper.BottomMostPoint)
                );

            if (isPredictionEnabled)
            {
                PositionTimestampReceivePackage predictedPackage =
                    _predictedPackages.LastOrDefault(_ => _.timestamp <= timestamp);
                if (predictedPackage == null)
                {
                    return;
                }

                Vector2 normalizedPredictedPosition = new Vector2(
                    ExtensionFunctions.Map(predictedPackage.percentX, -1, 1,
                                           _screenWrapper.LeftMostPoint, _screenWrapper.RightMostPoint),
                    ExtensionFunctions.Map(predictedPackage.percentY, 1, -1,
                                           _screenWrapper.TopMostPoint, _screenWrapper.BottomMostPoint)
                    );

                if (Vector2.Distance(normalizedPosition, normalizedPredictedPosition) > 1.5f)
                {
                    transform.position = normalizedPosition;
                    _bulletRb.velocity = velocity;
                }

                _predictedPackages.RemoveAll(_ => _.timestamp <= timestamp);
            }
            else
            {
                transform.position = normalizedPosition;
            }
        }
Example #28
0
        private void UpdateFillBarColor(float deltaTime)
        {
            _fillBarVertical.Update(deltaTime);
            _fillBarVertical.CurrentValue = GameInfo.TotalGameTime - _unhinderedTimeToImpact;

            float barHeight = _fillBarVertical.BarHeight;

            _fillBarFlasher.SetSize((int)_fillBarGradient.Width, (int)barHeight);

            float mappedFlashRate = ExtensionFunctions.Map(_unhinderedTimeToImpact, 0, 30, GameInfo.MaxBarFlashRate,
                                                           GameInfo.InitialBarFlashRate);

            _fillBarFlasher.FlashingRate = mappedFlashRate;
            _fillBarFlasher.Update(deltaTime);

            float reachedRatio = (GameInfo.TotalGameTime - _unhinderedTimeToImpact) / GameInfo.TotalGameTime;
            Color lerpedColor  = Color.Lerp(GameInfo.InitialTimerBarColor, GameInfo.FinalTimerBarColor, reachedRatio);

            _fillBarGradient.SpriteColor = lerpedColor;
        }
Example #29
0
        private void DisplayDamageEffect()
        {
            var currentHealth = _healthSetter.GetCurrentHealth();

            if (currentHealth <= _oneThirdHealth && !_smokeInstantiated)
            {
                var smokeInstance = Instantiate(smokeEffect, instancePoint.position,
                                                smokeEffect.transform.rotation);
                smokeInstance.transform.SetParent(instancePoint);
                _smokeEmission     = smokeInstance.GetComponent <ParticleSystem>().emission;
                _smokeInstantiated = true;
            }

            if (_smokeInstantiated)
            {
                var emissionRate = ExtensionFunctions.Map(currentHealth, 0, _oneThirdHealth,
                                                          MaxSmokeParticles, MinSmokeParticles);
                _smokeEmission.rateOverTime = emissionRate;
            }
        }
Example #30
0
        private void UpdatePlayerRacingTimer(float deltaTime)
        {
            if (_currentIncrementModifierTimer > 0)
            {
                _currentIncrementModifierTimer -= deltaTime;

                if (_currentIncrementModifierTimer <= 0)
                {
                    _playerCollisionTimerRate = GameInfo.PlayerTimerChangeRate;
                }
            }

            if (_hinderedPlayerTimer > 0)
            {
                _hinderedPlayerTimer -= _playerCollisionTimerRate * deltaTime;

                float   ratio = ExtensionFunctions.Map(_hinderedPlayerTimer, 0, GameInfo.TotalGameTime, 1, 0);
                Vector2 playerMarkerPosition =
                    Vector2.Lerp(_fillBarPointerInitialPosition, _fillBarPointerFinalPosition, ratio);
                _fillBarPointer.Position = playerMarkerPosition;

                if (_hinderedPlayerTimer <= 0)
                {
                    SetGameState(GameState.EndStarted);

                    _player.GameObject.Position = new Vector2(GameInfo.FixedWindowWidth / 2.0f, 0);
                    _player.SetPose(Player.Poses.Pose_1);
                    _player.PlayerSpriteSheet.StopSpriteAnimation();
                    _player.PlayerSetEndState();

                    foreach (Audience audience in _audiences)
                    {
                        audience.IsProjectileSpawningActive = false;
                        audience.ClearProjectiles();
                    }

                    _player.GameObject.Acceleration = Vector2.Zero;
                    _player.GameObject.Velocity     = Vector2.Zero;
                }
            }
        }