Esempio n. 1
0
    public static SavedAbilityAttribute ConvertFrom(AbilityAttribute attribute)
    {
        var obj = new SavedAbilityAttribute {
            type     = attribute.type,
            points   = attribute.points,
            priority = attribute.priority
        };

        foreach (var parameter in attribute.parameters)
        {
            obj.parameters.Add(SavedAbilityParameter.ConvertFrom(parameter));
        }
        return(obj);
    }
Esempio n. 2
0
    public static SavedAbilityParameter ConvertFrom(AbilityAttributeParameter parameter)
    {
        var obj = new SavedAbilityParameter {
            name = parameter.name
        };

        if (parameter.value is int)
        {
            obj.type   = "int";
            obj.intVal = (int)parameter.value;
        }
        else if (parameter.value is float)
        {
            obj.type     = "float";
            obj.floatVal = (float)parameter.value;
        }
        else
        {
            obj.type      = "string";
            obj.stringVal = (string)parameter.value;
        }
        return(obj);
    }