예제 #1
0
    public void OnMinusingPointTo(int _attrIndex)
    {
        GameCode.BasicAttributeName _basicAttrName = (GameCode.BasicAttributeName)_attrIndex;
        // the current point of the attribute we want to change
        int _currentPoint = PlayerData.GetInstance().GetAttributeValue(_basicAttrName);
        // unallocated point we have now
        int _pointToSpend = PlayerData.GetInstance().GetPointToSpend();

        if (_currentPoint - 1 > GameCode.minAttibuteValue)
        {
            PlayerData.GetInstance().SetPointToSpend(++_pointToSpend);
            PlayerData.GetInstance().SetAtttributeValue(_basicAttrName, --_currentPoint);
            pointToSpendText.text = _pointToSpend.ToString();
            basciAttrValueTexts[_attrIndex].text = _currentPoint.ToString();
        }

        DoSetAttrText(_attrIndex);
    }
예제 #2
0
    public void SetAtttributeValue(GameCode.BasicAttributeName _name, int _value)
    {
        m_basicAttributes[(int)_name] = _value;

        // set the general and extra attributes depend on the basic attributs
        switch (_name)
        {
        case GameCode.BasicAttributeName.Agility:
            hitRate   = _value / GameCode.maxAttributeValue * 0.2f + 0.8f;
            dodgeRate = _value / GameCode.maxAttributeValue;
            break;

        case GameCode.BasicAttributeName.Consitution:
            maxLife     = _value * 25 + 100;
            curLife     = maxLife;
            healingRate = _value * 0.01f + 0.1f;
            break;

        case GameCode.BasicAttributeName.Dexterity:
            atkSpeed  = _value / GameCode.maxAttributeValue * 2.0f + 1.0f;
            moveSpeed = _value / GameCode.maxAttributeValue * 6 + 6;
            break;

        case GameCode.BasicAttributeName.Intelligence:
            break;

        case GameCode.BasicAttributeName.Mentality:
            maxMana     = _value * 15 + 50;
            curMana     = maxMana;
            manaingRate = _value * 0.01f + 0.1f;
            break;

        case GameCode.BasicAttributeName.Strength:
            atk      = _value + 30;
            crit     = atk;
            critRate = 0;
            break;

        default:
            break;
        }
    }
예제 #3
0
 public int GetAttributeValue(GameCode.BasicAttributeName _name)
 {
     return(m_basicAttributes[(int)_name]);
 }