private static PropertyValueGenerator GetGenerator(string Name) { PropertyValueGenerator Generator = PropertyValueGenerator.GetGenerator(Name); if (Generator == null) { throw new KeyNotFoundException("Unable to find a PropertyValueGenerator named '" + Name + "'."); } return(Generator); }
private object[] GetArguments(object Instance, PropertyInfo Property) { if (_ValueGenerator == null) { _ValueGenerator = PropertyValueGenerator.GetGenerator("Identity"); } if (_ValueGenerator is IdentityValueGenerator) { return(_Arguments); } else { return(_Arguments.Select(c => ((ComponentArgument)c).GetValue(Instance, Property)).ToArray()); } }
// TODO: IMPORTANT: Make this be able to parse itself, so we can adjust instances within tiled by setting object properties. // Example: Name: PathComponent.Nodes Value: Collection(Vector2(50, 50), Vector2(100, 50)) /// <summary> /// Returns a ComponentArgument that returns the results of the specified arguments transformed by the specified ValueGenerator. /// </summary> public ComponentArgument(PropertyValueGenerator ValueGenerator, IEnumerable <ComponentArgument> Arguments) { this._ValueGenerator = ValueGenerator; this._Arguments = Arguments.Select(c => (object)c).ToArray(); }