当前位置: 首页>>代码示例>>C++>>正文


C++ ActorSet::end方法代码示例

本文整理汇总了C++中ActorSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ActorSet::end方法的具体用法?C++ ActorSet::end怎么用?C++ ActorSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActorSet的用法示例。


在下文中一共展示了ActorSet::end方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetObjectsTagged

ActorSet TagCollection::GetObjectsTagged(String findTag)
{
	StringList tags = SplitString(findTag, ", ");
	if (tags.size() == 0)
	{
		return ActorSet();
	}
	else if (tags.size() == 1)
	{
		findTag = ToLower(findTag);
		std::map<String, ActorSet>::iterator it = _tagMappings.find(findTag);
		if (it != _tagMappings.end())
		{
			return it->second;
		}
		else
		{
			return ActorSet();
		}
	}
	else
	{
		ActorSet t1;
		ActorSet t2;
		String searchTag = ToLower(tags[0]);
		
		bool t1_active = true;
		t1 = GetObjectsTagged(searchTag);

		for(unsigned int i=1; i < tags.size(); i++)
		{
			searchTag = ToLower(tags[i]);
			ActorSet compare = GetObjectsTagged(searchTag);
			if (t1_active)
			{
				std::set_intersection(t1.begin(), t1.end(), compare.begin(), compare.end(), std::inserter(t2, t2.begin()));
				t1.clear();
				t1_active = false;
			}
			else
			{
				std::set_intersection(t2.begin(), t2.end(), compare.begin(), compare.end(), std::inserter(t1, t1.begin()));
				t2.clear();
				t1_active = true;
			}
		}

		if (t1_active)
		{
			return t1;
		}
		else
		{
			return t2;
		}
	}
}
开发者ID:Gi133,项目名称:NetworkingCoursework,代码行数:57,代码来源:TagCollection.cpp

示例2: getApplicableTargets

ActorSet MonsterFSM::getApplicableTargets(void) const
{
	ASSERT(m_Owner!=0, "Owner was NULL");

	ActorSet s = m_Owner->getZone().getObjects().exclude(m_Owner->m_ID).typeFilter<Player>();

	// remove actors that are dead or ghosts
	ActorSet::iterator i = s.begin();
	while(i != s.end())
	{
		ActorSet::iterator nextIterator = i;
		++nextIterator;

		const Player &player = dynamic_cast<const Player&>(*i->second);

		if(!player.isAlive())
		{
			s.erase(i);
		}

		i = nextIterator;
	}

	return s;
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:25,代码来源:MonsterFSM.cpp

示例3: addAll

void ActorSet::addAll(ActorSet &s)
{
	for(ActorSet::iterator iter = s.begin(); iter != s.end(); ++iter)
	{
		insert(*iter);
	}
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:7,代码来源:ActorSet.cpp

示例4: Start

void DemoScreenPathfinding::Start()
{
	//Set up our obstacle course
	theWorld.LoadLevel("maze");
	
	//Create the bounding box that will limit the pathfinding search area
	BoundingBox bounds(Vector2(-20, -20), Vector2(20, 20));
	
	//Create our pathfinding graph. In our 2D worlds, this is a relatively fast
	// operation -- you shouldn't be doing it every frame, but recalculating every
	// so often if your world has changed is not inappropriate. 
	theSpatialGraph.CreateGraph(
		0.75f, //The size of the entity you want to pathfind (so the generator
		       //  can know how small a space can be and still have it fit.)
		bounds //The search area
	);
	
	//Create a MazeFinder (class definition below), and put him in the bottom
	//  left corner of the maze
	MazeFinder *mf = new MazeFinder();
	mf->SetPosition(-11.5, -8);
	theWorld.Add(mf);
	
	//Send him to the upper right, watch him scurry
	mf->GoTo(Vector2(11.5, 8));
	
	
	
	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	String description = "This little dude is pathfinding through the area.";
	description += "\n\nClick the mouse to give him a new target.";
	description += "\n\nPress [B] to see the pathfinding graph.";
	TextActor *t = new TextActor("Console", description);
	t->SetAlignment(TXT_Center);
	t->SetPosition(0.0f, -5.0f);
	theWorld.Add(t);
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenPathfinding.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(mf);
	ActorSet walls = theTagList.GetObjectsTagged("maze_wall");
	ActorSet::iterator it = walls.begin();
	while (it != walls.end())
	{
		_objects.push_back(*it);
		it++;
	}
	#pragma endregion
}
开发者ID:chrishaukap,项目名称:GameDev,代码行数:53,代码来源:DemoScreenPathfinding.cpp

示例5: exclude

ActorSet ActorSet::exclude(OBJECT_ID id) const
{
	ActorSet s = *this;

	ActorSet::iterator iter = s.find(id);

	if(iter != s.end()) // if present
	{
		s.erase(iter);
	}

	return s;
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:13,代码来源:ActorSet.cpp

示例6: Start

void DemoScreenLayeredCollisionLevelFile::Start()
{
	//Give names to some layers so we can reference them more easily
	theWorld.NameLayer("background", 0);
	theWorld.NameLayer("foreground", 1);
	theWorld.NameLayer("hud", 2);
	
	//Loads the file from Config\ActorDef\layeredcollisionlevel_demo.lua
	theWorld.LoadLevel("layeredcollisionlevel_demo");

	//All the magic happens in the level file!





	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	t2 = new TextActor("Console", "These new Actors were assigned layers in their level file.");
	t2->SetPosition(0, 5.5);
	t2->SetAlignment(TXT_Center);
	theWorld.Add(t2, 10);
	t3 = new TextActor("Console", "Layers can be given string names as well as numbers");
	t3->SetPosition(0, 4.5);
	t3->SetAlignment(TXT_Center);
	theWorld.Add(t3, 10);
	t4 = new TextActor("Console", "and assigned to Actors in their definition file or at runtime.");
	t4->SetPosition(0, 3.5);
	t4->SetAlignment(TXT_Center);
	theWorld.Add(t4, 10);
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenLayeredCollisionLevelFile.cpp, layeredcollisionlevel_demo.lua");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc, 10);
	_objects.push_back(fileLoc);
	_objects.push_back(t2);
	_objects.push_back(t3);
	_objects.push_back(t4);
	ActorSet spawnedActors = theTagList.GetObjectsTagged("spawned");
	ActorSet::iterator it = spawnedActors.begin();
	while (it != spawnedActors.end())
	{
		_objects.push_back(*it);
		it++;
	}
	#pragma endregion
}
开发者ID:CmPons,项目名称:angel2d,代码行数:47,代码来源:DemoScreenLayeredCollisionLevelFile.cpp

示例7: Update

void GotoTargetAIEvent::Update(float dt)
{
	ActorSet taggedActors = theTagList.GetObjectsTagged(_targetTag);
	for( ActorSet::iterator itr = taggedActors.begin(); itr != taggedActors.end(); itr++ )
	{
		Actor* pTargetActor = (*itr);
		if( theSpatialGraph.IsInPathableSpace( pTargetActor->GetPosition() ) )
		{
			_destination = pTargetActor->GetPosition();
			GotoAIEvent::Update( dt );
			return;
		}
	}

	//otherwise, we failed
	_moveFailed = true;
	IssueCallback();

}
开发者ID:chrishaukap,项目名称:GameDev,代码行数:19,代码来源:GotoTargetAIEvent.cpp

示例8: Start

void DemoScreenLevelFile::Start()
{
	//Loads the file from Config\ActorDef\level_demo.lua
	// Level files automatically add their actors to the world. 
	theWorld.LoadLevel("level_demo");

	//Since the Actors were just added directly to the world,
	//  we don't have handles to them. The level definition
	//  gave them the tag "spawned," so we can get them that way.
	ActorSet spawnedActors = theTagList.GetObjectsTagged("spawned");
	ActorSet::iterator it = spawnedActors.begin();
	while (it != spawnedActors.end())
	{
		//Can check Individual actors for tags as well.
		if ((*it)->IsTagged("left-tilted")) 
		{
			(*it)->SetRotation(25.0f);
		}
		else if ((*it)->IsTagged("right-tilted"))
		{
			(*it)->SetRotation(-25.0f);
		}
		//Applying tags
		(*it)->Tag("rotated");

		//Removing tags
		(*it)->Untag("spawned");
		it++;
	}





	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	t = new TextActor("Console", "These Actors were placed and tagged (\"left-tilted\"");
	t->SetPosition(0, 5.5);
	t->SetAlignment(TXT_Center);
	theWorld.Add(t);
	t2 = new TextActor("Console", "and \"right-tilted\") using a level definition file.");
	t2->SetPosition(0, 4.5);
	t2->SetAlignment(TXT_Center);
	theWorld.Add(t2);
	t3 = new TextActor("Console", "Then their rotations were set based on those tags.");
	t3->SetPosition(0, -4.5);
	t3->SetAlignment(TXT_Center);
	theWorld.Add(t3);
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenLevelFile.cpp, level_demo.lua");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(t2);
	_objects.push_back(t3);
	it = spawnedActors.begin();
	while (it != spawnedActors.end())
	{
		_objects.push_back(*it);
		it++;
	}
	#pragma endregion
}
开发者ID:FlorianDeconinck,项目名称:angel2d,代码行数:64,代码来源:DemoScreenLevelFile.cpp


注:本文中的ActorSet::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。