protected void SetInputLinkStateParam(int id, int value) { LBGameplayComponentLink l; SerializedProperty links, input_states, s; links = serializedObject.FindProperty("inputs"); l = new LBGameplayComponentLink(links, id); input_states = serializedObject.FindProperty("input_state_switch"); input_states.GetArrayElementAtIndex(l.ParamID).intValue = value; }
protected int FindOrCreateInputLinkStateParam(int id) { LBGameplayComponentLink l; SerializedProperty links, input_states, s; links = serializedObject.FindProperty("inputs"); l = new LBGameplayComponentLink(links, id); input_states = serializedObject.FindProperty("input_state_switch"); if (l.ParamID >= input_states.arraySize) { input_states.arraySize = l.ParamID + 1; input_states.GetArrayElementAtIndex(l.ParamID).intValue = 0; } return(input_states.GetArrayElementAtIndex(l.ParamID).intValue); }
protected virtual LBGameplayComponentLink FindOrMakeInputLink(SerializedProperty links, int id) { LBGameplayComponentLink link_to, link_from; SerializedProperty l, links_on_other; SerializedObject other; LBGameplayComponent g; int i; l = links.GetArrayElementAtIndex(id); link_to = new LBGameplayComponentLink(links, id); //l.Next(true); //gc = (LBGameplayComponent)l.objectReferenceValue; if (link_to.Target == null) { return(new LBGameplayComponentLink()); } other = new SerializedObject(link_to.Target); links_on_other = other.FindProperty("inputs"); for (i = 0; i < links_on_other.arraySize; i++) { l = links_on_other.GetArrayElementAtIndex(i); l.Next(true); g = (LBGameplayComponent)l.objectReferenceValue; if (g != null && g == serializedObject.targetObject) { return(new LBGameplayComponentLink(links_on_other, i)); } } links_on_other.arraySize++; l = links_on_other.GetArrayElementAtIndex(links_on_other.arraySize - 1); link_from = new LBGameplayComponentLink((LBLinkedGameplayComponent)serializedObject.targetObject, 0, 0); link_from.SetSerializedProperty(l); other.ApplyModifiedProperties(); return(link_from); }