Пример #1
0
 public void RemoveEffect(GOAPState _effect)
 {
     if (effects.Remove(_effect))
     {
         onEffectRemoved?.Invoke(_effect);
     }
 }
Пример #2
0
 public void RemovePrecondition(GOAPState _precondition)
 {
     if (preconditions.Remove(_precondition))
     {
         onPreconditionRemoved?.Invoke(_precondition);
     }
 }
Пример #3
0
 void OnEffectRemoved(GOAPState _newEffect)
 {
     if (EffectElements.TryGetValue(_newEffect, out VisualElement e))
     {
         effectFoldout.Remove(e);
         EffectElements.Remove(_newEffect);
     }
 }
Пример #4
0
 void OnPreconditionRemoved(GOAPState _condition)
 {
     if (ConditionElements.TryGetValue(_condition, out VisualElement e))
     {
         conditionFoldout.Remove(e);
         ConditionElements.Remove(_condition);
     }
 }
Пример #5
0
        void OnEffectAdded(GOAPState _newEffect)
        {
            VisualElement v = CreateToggle(_newEffect, (ele, state) =>
            {
                T_Model.RemoveEffect(state);
            });

            effectFoldout.Add(v);
            EffectElements[_newEffect] = v;
        }
Пример #6
0
        void OnPreconditionAdded(GOAPState _newCondition)
        {
            VisualElement v = CreateToggle(_newCondition, (ele, state) =>
            {
                T_Model.RemovePrecondition(state);
            });

            conditionFoldout.Add(v);
            ConditionElements[_newCondition] = v;
        }
Пример #7
0
        VisualElement CreateToggle(GOAPState _state, Action <VisualElement, GOAPState> _onBtnRemoveClicked)
        {
            VisualElement box = new VisualElement();

            box.style.flexDirection = FlexDirection.Row;

            Toggle toggle = new Toggle();

            toggle.value = _state.Value;
            toggle.RegisterValueChangedCallback(evt =>
            {
                _state.Value = evt.newValue;
            });
            toggle.style.width = 20;
            box.Add(toggle);

            TextField keyField = new TextField();

            keyField.value = _state.Key;
            keyField.RegisterValueChangedCallback(evt =>
            {
                _state.Key = evt.newValue;
            });
            keyField.style.flexGrow = 1;
            keyField.RegisterCallback <FocusInEvent>(evt => { Input.imeCompositionMode = IMECompositionMode.On; });
            keyField.RegisterCallback <FocusOutEvent>(evt => { Input.imeCompositionMode = IMECompositionMode.Auto; });
            box.Add(keyField);

            box.Add(CreateSmallButton(EditorGUIUtility.FindTexture("P4_DeletedLocal"), 14,
                                      () =>
            {
                _onBtnRemoveClicked?.Invoke(box, _state);
            }));
            box.userData = _state;
            return(box);
        }
Пример #8
0
 public void AddEffect(GOAPState _effect)
 {
     effects.Add(_effect);
     onEffectAdded?.Invoke(_effect);
 }
Пример #9
0
 public void AddPrecondition(GOAPState _precondition)
 {
     preconditions.Add(_precondition);
     onPreconditionAdded?.Invoke(_precondition);
 }