public InputAxis Union(InputAxis other) { if (other == null) { return(this); } if (other.Parameters.Count == 0) { return(this); } if (other.Parameters.Count == 1) { if (other.Parameters[0] is InputParameterEnumeration) { return(this); } var ret = new InputAxis(ReadableName, Origin) { KBRecord = KBRecord }; float newmin = Math.Min((Parameters[0] as InputParameterNumeric).MinimumValue, (other.Parameters[0] as InputParameterNumeric).MinimumValue); float newmax = Math.Max((Parameters[0] as InputParameterNumeric).MaximumValue, (other.Parameters[0] as InputParameterNumeric).MaximumValue); var param = new InputParameterNumeric(Parameters[0].ReadableName, newmin, newmax); ret.Parameters.Add(param); return(ret); } return(null); }
public InputAxis Clamp(List <InputParameterValue> parameters) { if (parameters == null) { return(this); } if (parameters.Count == 0) { return(this); } if (parameters.Count == 1) { if (parameters[0] is InputParameterValueEnumeration) { return(this); } var ret = new InputAxis(ReadableName, Origin) { KBRecord = KBRecord }; float newmin = (Parameters[0] as InputParameterNumeric).MinimumValue; float newmax = Math.Min((Parameters[0] as InputParameterNumeric).MaximumValue, (parameters[0] as InputParameterValueNumeric).Value); var param = new InputParameterNumeric(Parameters[0].ReadableName, newmin, newmax); ret.Parameters.Add(param); return(ret); } if (parameters.Count == 2) { var ret = new InputAxis(ReadableName, Origin) { KBRecord = KBRecord }; float newmin = Math.Max((Parameters[0] as InputParameterNumeric).MinimumValue, (parameters[0] as InputParameterValueNumeric).Value); float newmax = Math.Min((Parameters[1] as InputParameterNumeric).MaximumValue, (parameters[1] as InputParameterValueNumeric).Value); var param = new InputParameterNumeric(Parameters[0].ReadableName, newmin, newmax); ret.Parameters.Add(param); return(ret); } return(this); }
public InputParameterValueNumeric(InputParameterNumeric controller, float value) { ControllingParameter = controller; Value = value; }