public IcSkillGroup GetGroup() { if (!_currentGroup) { _currentGroup = (IcSkillGroup)_group.Copy(); } return(_currentGroup); }
private void OnEnable() { if (_types == null) { _types = TypeUtil.GetRuntimeFilterTypes.ToArray(); _ValueEditPopup = new ValueEditPopupWindow(); _ValueEditPopup.OnEdit = _save; _simpleTypeSelect = new SimpleTypeSelectPopupWindow(true, _types); } _varMapSer = serializedObject.FindProperty(IcSkillGroup.VarMapFieldName); _group = (IcSkillGroup)target; }
ChildGroupNode _getChildGroupNode(IcSkillGroup skillGroup) { if (!skillGroup) { return(null); } foreach (var node in skillGroup.nodes) { if (node is ChildGroupNode childGroupNode) { return(childGroupNode); } } return(null); }
public override void OnInspectorGUI() { serializedObject.Update(); { if (_lastGroup != _target.Group) { _lastGroup = _target.Group; //remove foreach (var key in _target.Data.Keys.ToList()) { if (!_lastGroup.VariableMap.ContainsKey(key)) { _target.Data.Remove(key); } } //update foreach (var pair in _lastGroup.VariableMap) { if (!_target.Data.TryGetValue(pair.Key, out var values)) { _target.Data.Add(pair.Key, new ValueS(pair.Value)); } else { if (values.ValueType != pair.Value.ValueType) { values.SetValue(null); values.ValueType = pair.Value.ValueType; } } } } base.OnInspectorGUI(); } serializedObject.ApplyModifiedProperties(); }
public virtual void Use(Dictionary <string, object> data) { if (CurrentSkill.RootNode.IsActive) { foreach (var skill in _skillGroups) { if (!skill.RootNode.IsActive) { CurrentSkill = skill; break; } } if (CurrentSkill.RootNode.IsActive) { CurrentSkill = CreateSkill(); CurrentSkill.Start(); } } CurrentSkill.SetBlackboardVariable(data); _debug(CurrentSkill.RootNode); CurrentSkill.RootNode.Start(); }
public override void OnBodyGUI() { if (_lastWindow != NodeEditorWindow.current) { _lastWindow = NodeEditorWindow.current; _updatePort(); } serializedObject.Update(); { EditorGUI.BeginChangeCheck(); { if (_groupSer == null) { _groupSer = serializedObject.FindProperty(GetChildGroupNode.GroupFieldName); } NodeEditorGUILayout.PropertyField(_groupSer, new GUIContent("Group")); _currentGroup = (IcSkillGroup)_groupSer.objectReferenceValue; } if (EditorGUI.EndChangeCheck()) { _updatePort(); } NodeEditorGUILayout.DynamicPortList("in", typeof(object), serializedObject, NodePort.IO.Input, Node.ConnectionType.Override, onCreation: _listSettingInput); NodeEditorGUILayout.DynamicPortList("out", typeof(object), serializedObject, NodePort.IO.Output, Node.ConnectionType.Multiple, onCreation: _listSettingOutput); NodeEditorGUILayout.PortField(new GUIContent("Group Root"), target.GetPort(nameof(GetChildGroupNode.OutValue))); } // Apply property modifications serializedObject.ApplyModifiedProperties(); }
protected override NPBehave.Node GetOutValue() { _group = GetInputValue(nameof(_group), _group); return(_group.GetChildGroupNode((IcSkillGroup)graph)); }
private void OnEnable() { _target = (SkillBehaveComponent)target; _lastGroup = _target.Group; }
private void _init() { CurrentSkill = CreateSkill(); CurrentSkill.Start(); Init(); }