예제 #1
0
void randommover::receivemessage(message msg)
{
	if(msg.get("changeposition"))
	{
		position.setx(msg.get("x"));
		position.sety(msg.get("y"));
	}
}
예제 #2
0
void pointdraw::receivemessage(message msg)
{
	if(msg.get("changeposition"))
	{
		x = msg.get("x");
		y = msg.get("y");
	}
}
예제 #3
0
void dumbmover::receivemessage(message msg)
{
	if(msg.get("changeposition"))
	{
		position.setx(msg.get("x"));
		position.sety(msg.get("y"));
	}
	if(msg.get("changedelta"))
	{
		delta.setx(msg.get("deltax"));
		delta.sety(msg.get("deltay"));
	}
}
예제 #4
0
std::shared_ptr<entity> entitybuilder::build(message msg)
{
	std::shared_ptr<entity> e = std::make_shared<entity>();
	if(msg.get("armament"))
	{
		e->insertcomponent(std::make_shared<armament>());
	}
	if(msg.get("dumbmover"))
	{
		e->insertcomponent(std::make_shared<dumbmover>());
	}
	if(msg.get("randommover"))
	{
		e->insertcomponent(std::make_shared<randommover>());
	}
	if(msg.get("lifetimer"))
	{
		e->insertcomponent(std::make_shared<lifetimer>());
	}
	if(msg.get("spawner"))
	{
		e->insertcomponent(std::make_shared<spawner>());
	}
	if(msg.get("trail"))
	{
		e->insertcomponent(std::make_shared<trail>());
	}
	if(msg.get("pointdraw"))
	{
		e->insertcomponent(std::make_shared<pointdraw>());
	}
	if(msg.get("shotdraw"))
	{
		e->insertcomponent(std::make_shared<shotdraw>());
	}
	if(msg.get("smoke"))
	{
		e->insertcomponent(std::make_shared<smoke>());
	}
	if(msg.get("transponder"))
	{
		e->insertcomponent(std::make_shared<transponder>());
	}
	e->pumpmessage(msg);
	return e; 
}