// 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(); }
/// <summary> /// Creates a ComponentArgument that simply returns the specified argument without being transformed. /// </summary> public ComponentArgument(object Argument) { this._ValueGenerator = null; this._Arguments = new object[] { Argument }; }
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(); }