public void PinConnected(NodeItem fromConnect, string property) { Type t = DotaAction.GetType(); var prop = t.GetProperty(property); if (prop == null) { throw new ArgumentException("Property must be a valid KV property"); } if(fromConnect.Node is VariableNode) { if (prop.PropertyType == typeof(NumberValue)) { var vn = fromConnect.Node as VariableNode; var nv = new NumberValue("%" + vn.Variable.Name); prop.SetMethod.Invoke(DotaAction, new object[] { nv }); } } if(fromConnect is TargetNodeItem) { if(prop.PropertyType == typeof(TargetKey)) { var target = (fromConnect as TargetNodeItem).Target; prop.SetMethod.Invoke(DotaAction, new object[] { target }); } } }
public TargetKey() { Preset = PresetType.TARGET; Center = PresetType.TARGET; Radius = new NumberValue(""); Length = new NumberValue(""); Thickness = new NumberValue(""); Teams = AbilityUnitTargetTeamFlags.DOTA_UNIT_TARGET_TEAM_ENEMY; UnitTypes = AbilityUnitTargetTypeFlags.DOTA_UNIT_TARGET_NONE; Flags = AbilityUnitTargetFlags.DOTA_UNIT_TARGET_FLAG_NONE; MaxTargets = new NumberValue("-1"); Random = new NumberValue(""); }