コード例 #1
0
ファイル: GameScore.cs プロジェクト: TashaSkyUp/Staging
    public void SetObjectiveProgress(float progress, int attackers, int defenders, Color defendColor, Color attackColor)
    {
        if (progress < 0.0f)
        {
            objectiveProgressRoot.SetActive(false);
        }
        else
        {
            objectiveProgressRoot.SetActive(true);

            if (attackers > 0)
            {
                attackersCount.Format("{0}", attackers);
                attackersCount.color = attackColor;
            }
            else
            {
                attackersCount.text = "";
            }
            if (defenders > 0)
            {
                defendersCount.Format("{0}", defenders);
                defendersCount.color = defendColor;
            }
            else
            {
                defendersCount.text = "";
            }

            objectiveProgressFill.sizeDelta = new Vector2(progress * 700.0f, objectiveProgressFill.sizeDelta.y);
            objectiveProgressFill.GetComponent <Image>().color = attackColor;
            objectiveBackground.color = new Color(defendColor.r, defendColor.g, defendColor.b, 0.5f);
        }
    }