Ejemplo n.º 1
0
        public TempList <AttributeVariable> GetAttributeVariables(IAttributeProvider attributeProvider)
        {
            var list = TempList <AttributeVariable> .Alloc();

            if (Attributes != null && Attributes.Length > 0)
            {
                switch (Type)
                {
                case AttributeSetType.NORMAL:
                    foreach (AttributeMetadata attribute in Attributes)
                    {
                        AttributeVariable v = new AttributeVariable((int)attribute.Type, new AttributeValue(attribute.ModifyType, attribute.Value));
                        list.Add(v);
                    }
                    break;

                case AttributeSetType.CHANGE:
                    AttributeVariable variable = attributeProvider.GetAttributeVariable((int)ChangeType);
                    if (!variable.Value.Value1.IsZero())
                    {
                        double d = variable.Value.Value1 / ChangeValue;
                        foreach (AttributeMetadata attribute in Attributes)
                        {
                            AttributeVariable v = new AttributeVariable((int)attribute.Type, new AttributeValue(AttributeModifyType.ABSOLUTE, attribute.Value * d));
                            list.Add(v);
                        }
                    }
                    break;
                }
            }
            return(list);
        }