コード例 #1
0
    public void ShowIntegrityLevelIdicator()
    {
        if (IntegrityProcentageIndicator != null)
        {
            if (_healthLevelIndicatorLocationOffset != Vector3.zero)
            {
                Instantiate(IntegrityProcentageIndicator, transform.position + _healthLevelIndicatorLocationOffset, Quaternion.identity, transform);
            }
            else
            {
                Instantiate(IntegrityProcentageIndicator, new Vector3(transform.position.x, 5, transform.position.z), Quaternion.identity, transform);
            }

            var textMesh = IntegrityProcentageIndicator.GetComponent <TextMesh>();
            textMesh.text  = $"{integrity.ToString("P0", CultureInfo.CreateSpecificCulture("hr-HR"))}";
            textMesh.color = integrity < 0.50f ? HexExtensions.ToColor("F6EB10"): HexExtensions.ToColor("00FF8A");
        }
    }