Example #1
0
        private void RefreshAttributeText(bool animate)
        {
            string attribute   = null;
            int    playerScore = PlayerScores.GetScoreFor(player_);

            if (playerScore > 0)
            {
                if (PlayerScores.Winner == player_)
                {
                    attribute = "WINNER!";
                }
                else if (PlayerScores.GetRankFor(player_) == 1)
                {
                    attribute = "LEADER!";
                }
            }

            attributeTextOutlet_.Text  = attribute;
            attributeTextOutlet_.Color = player_.Skin.UIColor;

            bool  showing      = !string.IsNullOrEmpty(attribute);
            float endScale     = showing ? 1.0f : 0.0f;
            float currentScale = attributeContainer_.transform.localScale.x;

            if (endScale == currentScale)
            {
                return;
            }

            if (animate)
            {
                this.StopAllCoroutines();

                this.DoSpringFor(kDuration, kDampingRatio, (float p) => {
                    float scale = Mathf.LerpUnclamped(currentScale, endScale, p);
                    attributeContainer_.transform.localScale = Vector3.one * scale;
                });
            }
            else
            {
                attributeContainer_.transform.localScale = Vector3.one * endScale;
            }
        }
Example #2
0
        private void RefreshScoreBar(bool animate)
        {
            int playerScore = PlayerScores.GetScoreFor(player_);

            startScoreBar_.SetScoreCount(playerScore, player_.Skin.UIColor, animate);
        }