示例#1
0
        protected void DrawGUI()
        {
            _mainHelpRect = EditorHelper.ShowHideableHelpBox("GameFramework.ConditionalActionEditor", "With this component you can configure actions that should be taken based upon different conditions that might occur.\nMore conditions and actions will come over time - if there is something you are missing then let us know. Alternatively easily create your own custom actions or add a callback .", _mainHelpRect);

            GameConditionEditorHelper.DrawConditions(serializedObject, _conditionReferencesProperty, conditionalAction.ConditionReferences,
                                                     ref conditionEditors, _gameConditionClassDetails, "Conditions", "Conditions that should be tested.");

            GameActionEditorHelper.DrawActions(serializedObject, _actionReferencesConditionMetProperty, conditionalAction.ActionReferencesConditionMet,
                                               ref actionEditorsMet, _gameActionClassDetails, _actionReferencesConditionMetCallbackProperty, heading: "Condition Met", tooltip: "Actions that will be run when the condition is met");

            GameActionEditorHelper.DrawActions(serializedObject, _actionReferencesConditionNotMetProperty, conditionalAction.ActionReferencesConditionNotMet,
                                               ref actionEditorsNotMet, _gameActionClassDetails, _actionReferencesConditionNotMetCallbackProperty, heading: "Condition Not Met", tooltip: "Actions that will be run when the condition is not met");
        }
示例#2
0
        protected virtual void OnEnable()
        {
            conditionalAction = (ConditionalAction)target;

            // get serialized objects so we can use attached property drawers (e.g. tooltips, ...)
            _conditionReferencesProperty                     = serializedObject.FindProperty("_conditionReferences");
            _actionReferencesConditionMetProperty            = serializedObject.FindProperty("_actionReferencesConditionMet");
            _actionReferencesConditionMetCallbackProperty    = serializedObject.FindProperty("_actionReferencesConditionMetCallback");
            _actionReferencesConditionNotMetProperty         = serializedObject.FindProperty("_actionReferencesConditionNotMet");
            _actionReferencesConditionNotMetCallbackProperty = serializedObject.FindProperty("_actionReferencesConditionNotMetCallback");

            // setup actions types
            _gameActionClassDetails    = GameActionEditorHelper.FindTypesClassDetails();
            _gameConditionClassDetails = GameConditionEditorHelper.FindTypesClassDetails();
        }