private float GetNewCord (AxisPositionControl theControl, float curVal, float targPos) { float newVal = curVal; switch (theControl.control) { case ControlType.SetWorld : newVal = theControl.setWorldVal; break; case ControlType.LocalFollow : newVal = targPos + theControl.localFollowOffset; break; } return newVal; }
private void DrawControl (string controlTitle, AxisPositionControl theControl) { EditorGUILayout.Space (); EditorGUILayout.LabelField (controlTitle); EditorGUI.indentLevel++; theControl.control = (ControlType)EditorGUILayout.EnumPopup ("Control Type", theControl.control); switch (theControl.control) { case ControlType.SetWorld : DrawControl_SetWorld (theControl); break; case ControlType.LocalFollow : DrawControl_LocalFollow (theControl); break; } EditorGUI.indentLevel--; }
private void DrawControl_LocalFollow (AxisPositionControl theControl) { theControl.localFollowTarget = EditorGUILayout.ObjectField ("Transform to Follow", theControl.localFollowTarget, typeof(Transform), true) as Transform; theControl.localFollowOffset = EditorGUILayout.FloatField ("Set Offset Amount", theControl.localFollowOffset); }
private void DrawControl_SetWorld (AxisPositionControl theControl) { theControl.setWorldVal = EditorGUILayout.FloatField ("Set World Position", theControl.setWorldVal); }