/// <summary>
        /// Returns Property value from propertyBonusDict summed with group bonus. If object does't contains queried property,
        /// returs new property with default value.
        /// </summary>
        /// <typeparam name="T">The type of the queried property.</typeparam>
        /// <param name="name">The name of the property. (PropertyEnum)</param>
        /// <returns>Returns founded property or new property with default value.</returns>
        protected T GetPropertyValue <T>(PropertyEnum name)
        {
            Property <T> bonus;

            // Group bonus
            if (!propertyBonusDict.ContainsKey(name.ToString()))
            {
                bonus = new Property <T>(default(T));
            }
            else
            {
                bonus = ((Property <T>)propertyBonusDict[name.ToString()]);
            }

            // Object property
            Property <T> property = GetProperty <T>(name);
            var          op       = Property <T> .Operator.Plus;

            return(bonus.SimpleMath(op, property).Value);
        }
Beispiel #2
0
        public PropertyNode GetProperty(PropertyEnum propertyType)
        {
            PropertyNode property;

            propertyDict.TryGetValue(propertyType, out property);
            System.Diagnostics.Debug.Assert(property == null,
                                            string.Format("error: {0} property not initialized.", propertyType.ToString()));
            return(property);
        }
Beispiel #3
0
    public BaseClass GetPropertyByEnum(PropertyEnum enumValue)
    {
        PropertyInfo pi = typeof(RootClass).GetProperty(enumValue.ToString());

        return(pi.GetValue(instance, null) as BaseClass);
    }