Esempio n. 1
0
    /// <summary>
    /// 获取所有的标记
    /// </summary>
    /// <returns></returns>
    PropertyMark GetAllMark()
    {
        PropertyMark mark = PropertyMark.None;

        foreach (PropertyMark temp in m_MarkDict.Values)
        {
            mark |= temp;
        }
        return(mark);
    }
Esempio n. 2
0
    /// <summary>
    /// 通过标记排除后,获取真正的属性值
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public PropertyValue GetProperty(PropertyValue value)
    {
        PropertyMark allMark = GetAllMark();

        if (allMark == PropertyMark.None)
        {
            return(value);
        }
        PropertyValue resultValue = value;

        if (CheckMark(allMark, PropertyMark.ForbidReduceHpMax))
        {
            resultValue.hpMax = value.hpMax < 0 ? 0 : value.hpMax;
        }
        return(resultValue);
    }
Esempio n. 3
0
    public bool RemovePropertyMark(IPropertyController effect)
    {
        PropertyMark oldMark = GetAllMark();

        if (m_MarkDict.Remove(effect))
        {
            if (oldMark != GetAllMark())
            {
                onPropertyMarkChanged.Invoke();
            }
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 4
0
 public bool AddPropertyMark(IPropertyController effect, PropertyMark mark)
 {
     if (!m_MarkDict.ContainsKey(effect))
     {
         PropertyMark oldMark = GetAllMark();
         m_MarkDict.Add(effect, mark);
         if (oldMark != GetAllMark())
         {
             onPropertyMarkChanged.Invoke();
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 5
0
 static bool CheckMark(PropertyMark sourceMark, PropertyMark targetMark)
 {
     return((sourceMark & targetMark) == targetMark);
 }