private void AddInput(JTInputAxis jtInput) { if (axis == null) { axis = new List <JTInputAxis>(); } if (axis.Exists(i => i.m_Name == jtInput.m_Name)) { axis.RemoveAll(i => i.m_Name == jtInput.m_Name); } axis.Add(jtInput); }
public void AddInput(SerializedProperty input) { AddInput(JTInputAxis.InputToJTInput(input)); }
public static JTInputAxis InputToJTInput(SerializedProperty input) { var jtia = new JTInputAxis(); var enumerator = input.Copy().GetEnumerator(); while (enumerator.MoveNext()) { var serializedProperty = enumerator.Current as SerializedProperty; if (serializedProperty != null) { if (serializedProperty.name == "m_Name") { jtia.m_Name = serializedProperty.stringValue; } if (serializedProperty.name == "descriptiveName") { jtia.descriptiveName = serializedProperty.stringValue; } if (serializedProperty.name == "descriptiveNegativeName") { jtia.descriptiveNegativeName = serializedProperty.stringValue; } if (serializedProperty.name == "negativeButton") { jtia.negativeButton = serializedProperty.stringValue; } if (serializedProperty.name == "positiveButton") { jtia.positiveButton = serializedProperty.stringValue; } if (serializedProperty.name == "altNegativeButton") { jtia.altNegativeButton = serializedProperty.stringValue; } if (serializedProperty.name == "altPositiveButton") { jtia.altPositiveButton = serializedProperty.stringValue; } if (serializedProperty.name == "gravity") { jtia.gravity = serializedProperty.floatValue; } if (serializedProperty.name == "dead") { jtia.dead = serializedProperty.floatValue; } if (serializedProperty.name == "sensitivity") { jtia.sensitivity = serializedProperty.floatValue; } if (serializedProperty.name == "snap") { jtia.snap = serializedProperty.boolValue; } if (serializedProperty.name == "invert") { jtia.invert = serializedProperty.boolValue; } if (serializedProperty.name == "type") { jtia.type = serializedProperty.enumNames[serializedProperty.enumValueIndex]; } if (serializedProperty.name == "axis") { jtia.axis = serializedProperty.enumNames[serializedProperty.enumValueIndex]; } if (serializedProperty.name == "joyNum") { jtia.joyNum = serializedProperty.enumNames[serializedProperty.enumValueIndex]; } } } return(jtia); }