Example #1
0
        protected override void Awake()
        {
            base.Awake();

            hpOwn      = transform.FindChild("War_View_HPOwn").GetComponent <HPView>();
            hpFriendly = transform.FindChild("War_View_HPFriendly").GetComponent <HPView>();
            hpEnemy    = transform.FindChild("War_View_HPEnemy").GetComponent <HPView>();
        }
Example #2
0
        protected override void OnUpdate()
        {
            base.OnUpdate();

            if (_relation != relation)
            {
                _relation = relation;
                if (hpView != null)
                {
                    hpView.gameObject.SetActive(false);
                }
                switch (_relation)
                {
                case RelationType.Own:
                    hpView = hpOwn;
                    break;

                case RelationType.Friendly:
                    hpView = hpFriendly;
                    break;

                default:
                    hpView = hpEnemy;
                    break;
                }

                if (_visible)
                {
                    hpView.max     = _max;
                    hpView.value   = _value;
                    hpView.uplevel = _uplevel;
                    hpView.gameObject.SetActive(true);
                }
            }

            if (_visible != visible)
            {
                _visible = visible;
                if (hpView != null)
                {
                    hpView.gameObject.SetActive(_visible);
                    if (_visible)
                    {
                        hpView.max     = _max;
                        hpView.value   = _value;
                        hpView.uplevel = _uplevel;
                    }
                }
            }
        }