Exemplo n.º 1
0
        public virtual void ApplyAttrs(eCreatureProp propType, int newV, int oldV)
        {
            int index = (int)propType;
            Action <CCreature, int, int> changeAction;

            if (m_dicPlayerData.TryGetValue(index, out changeAction))
            {
                changeAction(this, newV, oldV);
            }
        }
Exemplo n.º 2
0
        public virtual void AddPropNum(eCreatureProp propType, int addV)
        {
            int index = (int)propType;

            if (index < m_arrProp.Length)
            {
                int oldV = m_arrProp[index];
                int newV = oldV + addV;
                m_arrProp[index] = newV;
                ApplyAttrs(propType, newV, oldV);
            }
            else
            {
                Debug.LogError("属性索引越界" + index);
            }
        }
Exemplo n.º 3
0
        public virtual int GetPropNum(eCreatureProp propType)
        {
            if (m_arrProp == null)
            {
                return(0);
            }
            int index = (int)propType;

            if (index < m_arrProp.Length)
            {
                return(m_arrProp[index]);
            }
            else
            {
                Debug.LogError("属性索引越界" + index);
            }
            return(0);
        }
Exemplo n.º 4
0
        public virtual void SetPropNum(eCreatureProp propType, int newV)
        {
            if (m_arrProp == null)
            {
                //Debug.LogError("找不到属性,检测是不是UID重复时被移除的类:" + m_uId);
                return;
            }

            int index = (int)propType;

            if (index < m_arrProp.Length)
            {
                int oldV = m_arrProp[index];
                m_arrProp[index] = newV;
                ApplyAttrs(propType, newV, oldV);
            }
            else
            {
                Debug.LogError("属性索引越界" + index);
            }
        }