Exemplo n.º 1
0
		public BehaviorTreeSelectorWindow(BehaviorTreeWindow parent) : base(parent)
		{
			WindowTitle = "Select Tree";

			_windowRect = new Rect(100f, 100f, 200f, 500f);

			_currentSelected = new KeyValuePair<string, WeakReferenceT<INode>>();
		}
Exemplo n.º 2
0
		public SearchableSubWindow(BehaviorTreeWindow behaviorTreeWindow) : base(behaviorTreeWindow)
		{
			_scrollPosition = Vector2.zero;
			_filterText = "";
		}
Exemplo n.º 3
0
		protected SubWindow(BehaviorTreeWindow behaviorTreeWindow)
		{
			_parent = behaviorTreeWindow;
			
		}
Exemplo n.º 4
0
		public BehaviorContextSelectorWindow(BehaviorTreeWindow parent) : base(parent)
		{
			WindowTitle = "Select Context";

			_windowRect = new Rect(200f, 100f, 200f, 500f);

			_currentSelected = new WeakReferenceT<BehaviorContext>(null);

		}
Exemplo n.º 5
0
	public BehaviorGroupDrawer(BehaviorTreeWindow behaviorTreeWindow, BehaviorNodeDrawer parentNode, EditorRegionDecoratorNode childNode, BehaviorNodeDrawer childNodeDrawer)
	{
		this._behaviorTreeWindow = behaviorTreeWindow;

		_parentNode = parentNode;
		_childNode = childNode;
		_childNodeDrawer = childNodeDrawer;

		_label = childNode.label;

		_isExpanded = childNode.startExpanded;
	}
Exemplo n.º 6
0
	public BehaviorNodeDrawer(BehaviorTreeWindow behaviorTreeWindow, BehaviorNodeDrawer parentNode, INode nodeToDraw, float xPos, float yPos)
	{
		this._originalPos = new Vector2(xPos, yPos);
		this._behaviorTreeWindow = behaviorTreeWindow;
		this._parentNode = parentNode;
		
		var regionDecoratorNode = nodeToDraw as EditorRegionDecoratorNode;
		if (regionDecoratorNode != null)
		{
			_groupDrawer = new BehaviorGroupDrawer(behaviorTreeWindow, this, regionDecoratorNode, this);
			nodeToDraw = regionDecoratorNode.getChildNode();
		}

		_windowRect = new Rect(xPos, yPos, MIN_WIDTH, MIN_HEIGHT + nodeToDraw.GetGUIPropertyHeight());					
		_nodeToDraw = nodeToDraw;

		var leafNode = nodeToDraw as ILeafNode;
		if (leafNode != null)
		{
			type = VisualNodeType.LeafNode;
			_childrenNodes = new BehaviorNodeDrawer[0];
		}

		var decoratorNode = nodeToDraw as IDecoratorNode;
		if (decoratorNode != null)
		{
			type = VisualNodeType.DecoratorNode;

			_childrenNodes = new BehaviorNodeDrawer[1]
			{
				new BehaviorNodeDrawer(behaviorTreeWindow, this, decoratorNode.getChildNode(), _windowRect.x + INITIAL_HORIZONTAL_SPACING + MIN_WIDTH, _windowRect.y)
			};
		}

		var compositeNode = nodeToDraw as ICompositeNode;
		if (compositeNode != null)
		{
			type = VisualNodeType.CompositeNode;

			var compositeChilds = compositeNode.getChildNodes();

			_childrenNodes = new BehaviorNodeDrawer[compositeChilds.Length];

			for (int i = 0; i < compositeChilds.Length; i++)
			{
				_childrenNodes[i] = new BehaviorNodeDrawer(behaviorTreeWindow, this, compositeChilds[i], _windowRect.x + INITIAL_HORIZONTAL_SPACING + MIN_WIDTH, _windowRect.y);
			}
		}

		if (_groupDrawer != null)
			_groupDrawer.Init();

		var aggregatedHeight = 0f;

		for (int i = 0; i < _childrenNodes.Length; i++)
		{
			_childrenNodes[i].MoveVertical(aggregatedHeight);

			aggregatedHeight += _childrenNodes[i].GetCombinedHeight();
		}

		_windowTitle = _nodeToDraw.GetType().Name.Replace("Node", "").Replace("Decorator", "").Replace("Composite", "");
	}