void UpdateBar() { if (!powerBar.enabled) { return; } switch (barMovement) { case BarMovement.ToLeft: barFillAmount -= (barMoveSpeed * Time.fixedDeltaTime); break; case BarMovement.ToRight: barFillAmount += (barMoveSpeed * Time.fixedDeltaTime) - (barFillAmount * barMoveSpeed / 50); break; } if (barFillAmount >= .9f && barMovement == BarMovement.ToRight) { barMovement = BarMovement.ToLeft; } else if (barFillAmount <= .1 && barMovement == BarMovement.ToLeft) { barMovement = BarMovement.ToRight; } powerBar.GetComponent <Image>().fillAmount = barFillAmount; }
void ShowPowerBar() { barMovement = BarMovement.ToRight; barFillAmount = 0; powerBar.GetComponent <Image>().fillAmount = barFillAmount; barBG.enabled = true; powerBar.enabled = true; }
private void changeSpeed(BarMovement spawnedObstacleMovement) { float lastBarSpeed = SpawnManager.Get().BarSpeed; if (GameManager.Get().IsGameOver()) { spawnedObstacleMovement.Speed = lastBarSpeed; return; } if (ScoreManager.Instance.GetCurrentLevel() % 2 == 0) { spawnedObstacleMovement.Speed = lastBarSpeed; return; } SpawnManager.Get().BarSpeed = spawnedObstacleMovement.Speed + (ScoreManager.Instance.GetCurrentLevel() * barScoreLeveleMultiplier); lastBarSpeed = SpawnManager.Get().BarSpeed; spawnedObstacleMovement.Speed = lastBarSpeed; }