示例#1
0
void Rails::load(const WalkNodeList &nodes, DepthSurface *depthSurface, int depthStyle) {
	// Store the depth surface and depth style to use
	_depthSurface = depthSurface;
	_depthStyle = depthStyle;

	// Load the passed node list
	_nodes.clear();

	for (uint i = 0; i < nodes.size(); ++i)
		_nodes.push_back(nodes[i]);

	// Add two more empty nodes for the start and end points of any walk sequence
	_nodes.push_back(WalkNode());
	_nodes.push_back(WalkNode());
}
示例#2
0
	void SortHandlerVector(Node* node, std::vector<BaseEventHandler*>& canHandle) {
		std::vector<BaseEventHandler*> sorted;
		sorted.reserve(canHandle.size());
		auto inserter = [&sorted, &canHandle](Node* n) {
			for (auto it = canHandle.begin(); it != canHandle.end(); it++) {
				if (n == (*it)->GetOwner()) {
					sorted.push_back(*it);
					canHandle.erase(it);
					break;
				}
			}
		};
		if (node->GetScene() && node->GetScene()->GetUi()) {
			// UI always gets the first pick
			WalkNode(node->GetScene()->GetUi(), inserter, false /* dont iterate over scene, thats done below*/);
		}
		WalkNode(node, inserter);
		// fill in all the remaining ones that don't match any node
		for (auto h : canHandle) {
			sorted.push_back(h);
		}
		canHandle.swap(sorted);
	}