// INITIALIZE // // public void Initialize(string theName, float f, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theName, theOwnerBlueprint); constant = f; randomMax = f; curve = ScriptableObject.CreateInstance <ScalarCurve>(); curve.Initialize(f, theName + "_curve"); curveMin = ScriptableObject.CreateInstance <ScalarCurve>(); curveMin.Initialize(f, theName + "_curveMin"); curveMax = ScriptableObject.CreateInstance <ScalarCurve>(); curveMax.Initialize(f, theName + "_curveMax"); isInteger = false; Randomize(); }
// COPY PROPERTY // // override public void CopyProperty(BaseProperty originalProperty, AmpsBlueprint theOwnerBlueprint) { base.CopyProperty(originalProperty, theOwnerBlueprint); ScalarProperty originalScalarProperty = originalProperty as ScalarProperty; constant = originalScalarProperty.constant; randomMin = originalScalarProperty.randomMin; randomMax = originalScalarProperty.randomMax; curve = ScriptableObject.CreateInstance <ScalarCurve>(); curve.Initialize(originalScalarProperty.curve); curveMin = ScriptableObject.CreateInstance <ScalarCurve>(); curveMin.Initialize(originalScalarProperty.curveMin); curveMax = ScriptableObject.CreateInstance <ScalarCurve>(); curveMax.Initialize(originalScalarProperty.curveMax); isInteger = originalScalarProperty.isInteger; Randomize(); }
// INITIALIZE // // public void Initialize(ScalarCurve originalCurve) { curveInput = originalCurve.curveInput; curveInputVectorComponent = originalCurve.curveInputVectorComponent; curveInputColorComponent = originalCurve.curveInputColorComponent; curveInputCoordSystem = originalCurve.curveInputCoordSystem; inputRangeMin = originalCurve.inputRangeMin; inputRangeMax = originalCurve.inputRangeMax; isInputRangeRandom = originalCurve.isInputRangeRandom; inputRangeRandomMin = originalCurve.inputRangeRandomMin; inputRangeRandomMax = originalCurve.inputRangeRandomMax; outputRangeMin = originalCurve.outputRangeMin; outputRangeMax = originalCurve.outputRangeMax; curve = new AnimationCurve(originalCurve.curve.keys); curve.preWrapMode = originalCurve.curve.preWrapMode; curve.postWrapMode = originalCurve.curve.postWrapMode; name = originalCurve.name; Randomize(); }
// CURVE PICKER INPUT // // public void CurvePickerInput(ScalarCurve theCurve) { GUILayout.BeginHorizontal(); GUILayout.Label("Input"); GUILayout.FlexibleSpace(); theCurve.curveInput = (AmpsHelpers.eCurveInputs)SortedPopup((int)theCurve.curveInput, AmpsHelpers.curveInputDisplayData, GUILayout.Width(120)); if (AmpsHelpers.isFloatInput(theCurve.curveInput) == false) { theCurve.curveInputVectorComponent = (AmpsHelpers.eVectorComponents)SortedPopup((int)theCurve.curveInputVectorComponent, AmpsHelpers.vectorComponentsDisplayData, GUILayout.Width(40)); } else { GUILayout.Space(40); } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (theCurve.curveInput == AmpsHelpers.eCurveInputs.Acceleration || theCurve.curveInput == AmpsHelpers.eCurveInputs.Position || theCurve.curveInput == AmpsHelpers.eCurveInputs.Rotation || theCurve.curveInput == AmpsHelpers.eCurveInputs.RotationRate || theCurve.curveInput == AmpsHelpers.eCurveInputs.Velocity) { theCurve.curveInputCoordSystem = coordSystemPopup(theCurve.curveInputCoordSystem); } GUILayout.BeginHorizontal(); GUILayout.Label("Random range?"); GUILayout.FlexibleSpace(); theCurve.isInputRangeRandom = GUILayout.Toggle(theCurve.isInputRangeRandom, "", "toggle"); GUILayout.EndHorizontal(); GUILayout.Space(16); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 30; EditorGUIUtility.fieldWidth = 5; GUILayout.Space(50); GUILayout.BeginVertical(); //GUILayout.Label("From"); if (theCurve.isInputRangeRandom) { theCurve.inputRangeMin = MyFloatField("", theCurve.inputRangeMin, GUILayout.ExpandWidth(false)); theCurve.inputRangeRandomMin = MyFloatField("", theCurve.inputRangeRandomMin, GUILayout.ExpandWidth(false)); } else { theCurve.inputRangeMin = MyFloatField("", theCurve.inputRangeMin, GUILayout.ExpandWidth(false)); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); //GUILayout.Label("To"); if (theCurve.isInputRangeRandom) { theCurve.inputRangeMax = MyFloatField("", theCurve.inputRangeMax, GUILayout.ExpandWidth(false)); theCurve.inputRangeRandomMax = MyFloatField("", theCurve.inputRangeRandomMax, GUILayout.ExpandWidth(false)); } else { theCurve.inputRangeMax = MyFloatField("", theCurve.inputRangeMax, GUILayout.ExpandWidth(false)); } GUILayout.EndVertical(); EditorGUIUtility.labelWidth = 0; EditorGUIUtility.fieldWidth = 0; GUILayout.EndHorizontal(); }