bool CheckIfCustomProbability()
        {
            bool customProb = false;

            VariableMixingType mixingType = (VariableMixingType)VariableProperty.FindPropertyRelative(nameof(IndependentVariable.MixingType)).intValue;

            customProb = mixingType == VariableMixingType.CustomProbability;


            return(customProb);
        }
        protected override void DrawVariableSpecificInspector()
        {
            SerializedProperty blockProperty = VariableProperty.FindPropertyRelative(nameof(IndependentVariable.Block));

            CheckMaxBlockPermutationsAllowed(blockProperty.boolValue);



            EditorGUILayout.PropertyField(blockProperty);

            SerializedProperty mixType = VariableProperty.FindPropertyRelative(nameof(IndependentVariable.MixingType));
            VariableMixingType op      = (VariableMixingType)mixType.intValue;

            op = (VariableMixingType)EditorGUILayout.EnumPopup("Mixing Type", op);
            mixType.intValue = (int)op;



            if (valuesProperty.arraySize == 0)
            {
                VariableValidationResults.AddWarning("No values");
            }

            bool isCustomProbability = CheckIfCustomProbability();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            valuesList.DoLayoutList();
            EditorGUILayout.Space();

            if (isCustomProbability)
            {
                CalculateFinalProbability();
                CheckProbabilityErrors(true);
            }


            if (waitingToClearAllValues)
            {
                int n = valuesProperty.arraySize;
                for (int i = 0; i < n; i++)
                {
                    RemoveValue(0);
                    RemoveProbability(0);
                }

                waitingToClearAllValues = false;
            }
        }
Example #3
0
        protected override void DrawVariableSpecificInspector()
        {
            EditorGUI.indentLevel++;

            SerializedProperty constrainProperty = VariableProperty.FindPropertyRelative("ConstrainValues");

            EditorGUILayout.PropertyField(constrainProperty);

            if (constrainProperty.boolValue)
            {
                EditorGUILayout.LabelField("Possible Values");
                valuesList.DoLayoutList();
            }
            EditorGUI.indentLevel--;
        }
Example #4
0
        protected override void DrawVariableSpecificInspector()
        {
            SerializedProperty defaultValueProperty = VariableProperty.FindPropertyRelative("DefaultValue");

            EditorGUILayout.PropertyField(defaultValueProperty);
        }