Exemplo n.º 1
0
 private void UpdateText(TimeSpan remainingTime)
 {
     if (LivesManager.Instance.LivesRemaining == RemoteConfigHelper.GetMaxLives())
     {
         countdown.text = "At maximum credits";
     }
     else
     {
         var livesLeft = LivesManager.Instance.LivesRemaining == 0 ? $"No credits remaining{Environment.NewLine}" : string.Empty;
         countdown.text = $"{livesLeft}Next credit in {remainingTime.Minutes} minute(s) and {remainingTime.Seconds} second(s).";
     }
 }
        private void SetupProgressBar(Colour pieceColour, int piecesCollected, int gained)
        {
            int increment = RemoteConfigHelper.GetCollectionInterval(pieceColour);

            var multiplier = (piecesCollected / increment) + 1;

            var gainedText = gained > 0 ? $" (+{gained})" : string.Empty;

            ProgressBar.UpdateProgressBar(piecesCollected % increment, increment, $"{piecesCollected}/{(increment * multiplier)}{gainedText}");

            if (piecesCollected % increment == 0)
            {
                GameResources.PlayEffect("Powerup Unlocked", Camera.main.ScreenToWorldPoint(PowerupSlot.transform.position));
            }
        }
Exemplo n.º 3
0
        private void Update()
        {
            if (countdown == null)
            {
                return;
            }

            var remainingTime = LivesManager.Instance.LastEarnedLife.AddMinutes(RemoteConfigHelper.GetLivesRefreshTime()) - DateTime.Now;

            if (remainingTime.TotalMilliseconds < 0)
            {
                remainingTime = new TimeSpan(0, 0, 0);
            }

            UpdateText(remainingTime);
        }
        private static PieceTypes GetSpecialPiece()
        {
            var type = PieceTypes.Normal;

            string[] specialDropPieces = LevelManager.Instance.SelectedLevel.SpecialDropPieces;
            if (specialDropPieces != null && specialDropPieces.Length > 0 && Random.Range(0, 100) <= RemoteConfigHelper.MaxChanceToUseSpecialPiece())
            {
                var randomSpecial = specialDropPieces[Random.Range(0, specialDropPieces.Length)];

                type = (PieceTypes)randomSpecial[0];

                var existingCountOfPiece = PieceManager.Instance.Pieces.Where(x => x.Type == type).Count();
                if (existingCountOfPiece > RemoteConfigHelper.MaxCountOfPiece(type))
                {
                    type = PieceTypes.Normal;
                }
            }

            return(type);
        }