public void OnSceneGUI() { if (fsmComponent == null) { return; } var fsm = fsmComponent.Fsm; if (fsm == null) { return; } if (fsm.EditState != null) { if (fsm.EditState.ActionData == null) { return; } fsm.EditState.Fsm = fsm; for (var k = 0; k < fsm.EditState.Actions.Length; k++) { var iTweenMoveTo = fsm.EditState.Actions[k] as iTweenMoveTo; if (iTweenMoveTo != null) { temp = iTweenMoveTo; if (temp.transforms.Length >= 2) { Undo.SetSnapshotTarget(fsmComponent.gameObject, Strings.Command_Adjust_iTween_Path); tempVct3 = new Vector3[temp.transforms.Length]; for (var i = 0; i < temp.transforms.Length; i++) { if (temp.transforms[i].IsNone) tempVct3[i] = temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value; else { if (temp.transforms[i].Value == null) { tempVct3[i] = temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value; } else { tempVct3[i] = temp.transforms[i].Value.transform.position + (temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value); } } tempVct3[i] = Handles.PositionHandle(tempVct3[i], Quaternion.identity); if (temp.transforms[i].IsNone) { if (!temp.vectors[i].IsNone) { temp.vectors[i].Value = tempVct3[i]; } } else { if (temp.transforms[i].Value == null) { if (!temp.vectors[i].IsNone) { temp.vectors[i].Value = tempVct3[i]; } } else { if (!temp.vectors[i].IsNone) { temp.vectors[i] = tempVct3[i] - temp.transforms[i].Value.transform.position; } } } } Handles.Label(tempVct3[0], string.Format(Strings.iTween_Path_Editing_Label_Begin, fsmComponent.name)); Handles.Label(tempVct3[tempVct3.Length - 1], string.Format(Strings.iTween_Path_Editing_Label_End, fsmComponent.name)); if (GUI.changed) FsmEditor.EditingActions(); } } } } }
public void OnSceneGUI() { // can happen when playmaker is updated if (fsmComponent == null) { return; } var fsm = fsmComponent.Fsm; if (fsm.EditState != null) { fsm.EditState.Fsm = fsm; for (var k = 0; k < fsm.EditState.Actions.Length; k++) { var iTweenMoveTo = fsm.EditState.Actions[k] as iTweenMoveTo; if (iTweenMoveTo != null) { temp = iTweenMoveTo; if (temp.transforms.Length >= 2) { Undo.SetSnapshotTarget(fsmComponent.gameObject, "Adjust iTween Path"); tempVct3 = new Vector3[temp.transforms.Length]; for (var i = 0; i < temp.transforms.Length; i++) { if (temp.transforms[i].IsNone) tempVct3[i] = temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value; else { if (temp.transforms[i].Value == null) { tempVct3[i] = temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value; } else { tempVct3[i] = temp.transforms[i].Value.transform.position + (temp.vectors[i].IsNone ? Vector3.zero : temp.vectors[i].Value); } } tempVct3[i] = Handles.PositionHandle(tempVct3[i], Quaternion.identity); if (temp.transforms[i].IsNone) { if (!temp.vectors[i].IsNone) { temp.vectors[i].Value = tempVct3[i]; } } else { if (temp.transforms[i].Value == null) { if (!temp.vectors[i].IsNone) { temp.vectors[i].Value = tempVct3[i]; } } else { if (!temp.vectors[i].IsNone) { temp.vectors[i] = tempVct3[i] - temp.transforms[i].Value.transform.position; } } } } Handles.Label(tempVct3[0], "'" + fsmComponent.name + "' Begin"); Handles.Label(tempVct3[tempVct3.Length - 1], "'" + fsmComponent.name + "' End"); if (GUI.changed) FsmEditor.EditingActions(); } } } } }