示例#1
0
        // add an amount to stat value
        public void AddValue(float amount)
        {
            if (_isWizard && _oneHealthTriggerWizard)
            {
                ProcessWizardSpared();
            }
            else
            {
                if (_isPhoenix)
                {
                    _currentValue = _maxValue;
                    GetComponent <ItemDropper>().DropGoodItem();
                    //_shieldActive = true;
                    gameObject.tag = "Untagged";
                    ActionBarUIController.Instance.HideFireboltFlash();
                    ActionBarUIController.Instance.HideHealFlash();
                    _oneHealthComController.ComEventTrigger(1, true);
                }
                else
                {
                    if (amount < 0)
                    {
                        Debug.LogError("Stats AddValue Error: Attempting to add negative amounts to stat!");
                    }

                    // verify addition of value not above max
                    float tempVal = amount + _currentValue;
                    if (amount > _maxValue || tempVal > _maxValue)
                    {
                        _currentValue = _maxValue;
                    }
                    else
                    {
                        _currentValue = tempVal;
                    }
                }

                UpdateUI();
            }
        }